Skip to content

Commit 4b353c6

Browse files
authored
Consistently use http://example.com/webhooks/ as base for callbacks (#334)
1 parent ae4cdbc commit 4b353c6

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ $outboundCall = new \Vonage\Voice\OutboundCall(
320320
);
321321
$outboundCall
322322
->setAnswerWebhook(
323-
new \Vonage\Voice\Webhook('https://example.com/answer')
323+
new \Vonage\Voice\Webhook('https://example.com/webhooks/answer')
324324
)
325325
->setEventWebhook(
326-
new \Vonage\Voice\Webhook('https://example.com/event')
326+
new \Vonage\Voice\Webhook('https://example.com/webhooks/event')
327327
)
328328
;
329329

@@ -364,7 +364,7 @@ $outboundCall = new \Vonage\Voice\OutboundCall(
364364

365365
$ncco = new NCCO();
366366
$ncco->addAction(\Vonage\Voice\NCCO\Action\Record::factory([
367-
'eventUrl' => 'https://webhook.url'
367+
'eventUrl' => 'https://example.com/webhooks/event'
368368
]);
369369
$outboundCall->setNCCO($ncco);
370370

@@ -416,7 +416,7 @@ $outboundCall = new \Vonage\Voice\OutboundCall(
416416
);
417417

418418
$ncco = new NCCO();
419-
$ncco->addAction(new \Vonage\Voice\NCCO\Action\Stream('https://my-mp3.url'));
419+
$ncco->addAction(new \Vonage\Voice\NCCO\Action\Stream('https://example.com/sounds/my-audio.mp3'));
420420
$outboundCall->setNCCO($ncco);
421421

422422
$response = $client->voice()->createOutboundCall($outboundCall);
@@ -439,7 +439,7 @@ $ncco->addAction(\Vonage\Voice\NCCO\Action\Talk::factory('Please record your nam
439439
]));
440440

441441
$ncco->addAction(\Vonage\Voice\NCCO\Action\Input::factory([
442-
'eventUrl' => 'https://webhook.url',
442+
'eventUrl' => 'https://example.com/webhooks/event',
443443
'type' => [
444444
'speech',
445445
],
@@ -467,7 +467,7 @@ $ncco = new NCCO();
467467
$ncco->addAction(new \Vonage\Voice\NCCO\Action\Talk('We are just testing the notify function, you do not need to do anything.'));
468468
$ncco->addAction(new \Vonage\Voice\NCCO\Action\Notify([
469469
'foo' => 'bar',
470-
], new Vonage\Voice\Webhook('https://webhook.url')));
470+
], new Vonage\Voice\Webhook('https://example.com/webhooks/notify')));
471471
$outboundCall->setNCCO($ncco);
472472

473473
$response = $client->voice()->createOutboundCall($outboundCall);
@@ -509,32 +509,32 @@ $application->fromArray([
509509
'voice' => [
510510
'webhooks' => [
511511
'answer_url' => [
512-
'address' => 'https://example.com/answer',
512+
'address' => 'https://example.com/webhooks/answer',
513513
'http_method' => 'GET',
514514
],
515515
'event_url' => [
516-
'address' => 'https://example.com/event',
516+
'address' => 'https://example.com/webhooks/event',
517517
'http_method' => 'POST',
518518
],
519519
]
520520
],
521521
'messages' => [
522522
'webhooks' => [
523523
'inbound_url' => [
524-
'address' => 'https://example.com/inbound',
524+
'address' => 'https://example.com/webhooks/inbound',
525525
'http_method' => 'POST'
526526

527527
],
528528
'status_url' => [
529-
'address' => 'https://example.com/status',
529+
'address' => 'https://example.com/webhooks/status',
530530
'http_method' => 'POST'
531531
]
532532
]
533533
],
534534
'rtc' => [
535535
'webhooks' => [
536536
'event_url' => [
537-
'address' => 'https://example.com/event',
537+
'address' => 'https://example.com/webhooks/event',
538538
'http_method' => 'POST',
539539
],
540540
]
@@ -552,11 +552,11 @@ You can also pass the client an application object:
552552
$a = new Vonage\Application\Application();
553553

554554
$a->setName('PHP Client Example');
555-
$a->getVoiceConfig()->setWebhook('answer_url', 'https://example.com/answer', 'GET');
556-
$a->getVoiceConfig()->setWebhook('event_url', 'https://example.com/event', 'POST');
557-
$a->getMessagesConfig()->setWebhook('status_url', 'https://example.com/status', 'POST');
558-
$a->getMessagesConfig()->setWebhook('inbound_url', 'https://example.com/inbound', 'POST');
559-
$a->getRtcConfig()->setWebhook('event_url', 'https://example.com/event', 'POST');
555+
$a->getVoiceConfig()->setWebhook('answer_url', 'https://example.com/webhooks/answer', 'GET');
556+
$a->getVoiceConfig()->setWebhook('event_url', 'https://example.com/webhooks/event', 'POST');
557+
$a->getMessagesConfig()->setWebhook('status_url', 'https://example.com/webhooks/status', 'POST');
558+
$a->getMessagesConfig()->setWebhook('inbound_url', 'https://example.com/webhooks/inbound', 'POST');
559+
$a->getRtcConfig()->setWebhook('event_url', 'https://example.com/webhooks/event', 'POST');
560560
$a->disableVbc();
561561

562562
$client->applications()->create($a);

0 commit comments

Comments
 (0)