Create a new Webhook for the Service
Create a new Webhook for the Service
Path parameters
-
The unique SID identifier of the Service.
Minimum length is
34
, maximum length is34
. Format should match the following pattern:^VA[0-9a-fA-F]{32}$
.
Body
-
The string that you assigned to describe the webhook. This value should not contain PII.
-
The array of events that this Webhook is subscribed to. Possible event types:
*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied
-
The URL associated with this Webhook.
-
The webhook status. Default value is
enabled
. One of:enabled
ordisabled
Values are
enabled
ordisabled
. -
The webhook version. Default value is
v2
which includes all the latest fields. Versionv1
is legacy and may be removed in the future.Values are
v1
orv2
.
POST
/v2/Services/{ServiceSid}/Webhooks
curl \
--request POST 'https://verify.twilio.com/v2/Services/{ServiceSid}/Webhooks' \
--user "username:password" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data 'Version=v2&EventTypes=factor.deleted&EventTypes=factor.verified&WebhookUrl=https%3A%2F%2Fowlbank.twilio.com&FriendlyName=name'
Request example
{"Version"=>"v2", "EventTypes"=>["factor.deleted", "factor.verified"], "WebhookUrl"=>"https://owlbank.twilio.com", "FriendlyName"=>"name"}
Response examples (201)
{
"sid": "YWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks/YWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"status": "enabled",
"version": "v2",
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"event_types": [
"factor.deleted",
"factor.verified"
],
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"webhook_url": "https://owlbank.twilio.com",
"date_created": "2015-07-30T20:00:00Z",
"date_updated": "2015-07-30T20:00:00Z",
"friendly_name": "name",
"webhook_method": "POST"
}