Create a new Webhook for the Service

POST /v2/Services/{ServiceSid}/Webhooks

TODO: Resource-level docs

Create a new Webhook for the Service

Path parameters

  • ServiceSid string Required

    The unique SID identifier of the Service.

application/x-www-form-urlencoded

Body

  • EventTypes array[string] Required

    The array of events that this Webhook is subscribed to. Possible event types: *, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied

  • FriendlyName string Required

    The string that you assigned to describe the webhook. This value should not contain PII.

  • Status string

    The webhook status. Default value is enabled. One of: enabled or disabled

    Values are enabled or disabled.

  • Version string

    The webhook version. Default value is v2 which includes all the latest fields. Version v1 is legacy and may be removed in the future.

    Values are v1 or v2.

  • WebhookUrl string Required

    The URL associated with this Webhook.

Responses

  • 201

    Created

    Hide response attributes Show response attributes object
    • account_sid string | null

      The SID of the Account that created the resource

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • date_created string(date-time) | null

      The ISO 8601 date and time in GMT when the resource was created

    • date_updated string(date-time) | null

      The ISO 8601 date and time in GMT when the resource was last updated

    • event_types array[string] | null

      The array of events that this Webhook is subscribed to.

    • friendly_name string | null

      The string that you assigned to describe the webhook

    • service_sid string | null

      Service Sid.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^VA[0-9a-fA-F]{32}$.

    • sid string | null

      The unique string that identifies the resource

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^YW[0-9a-fA-F]{32}$.

    • status string | null

      The webhook status

      Values are enabled or disabled.

    • url string(uri) | null

      The absolute URL of the Webhook resource

    • version string | null

      The webhook version

      Values are v1 or v2.

    • webhook_method string | null

      The method used when calling the webhook's URL.

      Values are GET or POST.

    • webhook_url string(uri) | null

      The URL associated with this Webhook.

POST /v2/Services/{ServiceSid}/Webhooks
curl \
 -X POST https://verify.twilio.com/v2/Services/{ServiceSid}/Webhooks \
 --user "username:password" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d 'EventTypes=string&FriendlyName=string&Status=enabled&Version=v1&WebhookUrl=string'
Request example
{
  "EventTypes": [
    "string"
  ],
  "FriendlyName": "string",
  "Status": "enabled",
  "Version": "v1",
  "WebhookUrl": "string"
}
Response examples (201)
{
  "account_sid": "string",
  "date_created": "2023-05-04T09:42:00+00:00",
  "date_updated": "2023-05-04T09:42:00+00:00",
  "event_types": [
    "string"
  ],
  "friendly_name": "string",
  "service_sid": "string",
  "sid": "string",
  "status": "enabled",
  "url": "https://example.com",
  "version": "v1",
  "webhook_method": "GET",
  "webhook_url": "https://example.com"
}