Create binding

POST /v1/Services/{ServiceSid}/Bindings

Path parameters

  • ServiceSid string Required

    The SID of the Service to create the resource under.

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

application/x-www-form-urlencoded

Body

  • Identity string Required

    The identity value that uniquely identifies the new resource's User within the Service. Up to 20 Bindings can be created for the same Identity in a given Service.

  • BindingType string Required

    The transport technology to use for the Binding. Can be: apn, fcm, gcm, sms, or facebook-messenger.

    Values are apn, gcm, sms, fcm, facebook-messenger, or alexa.

  • Address string Required

    The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format.

  • Tag array[string]

    A tag that can be used to select the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 20 tags.

  • NotificationProtocolVersion string

    The protocol version to use to send the notification. This defaults to the value of default_xxxx_notification_protocol_version for the protocol in the Service. The current version is "3" for apn, fcm, and gcm type Bindings. The parameter is not applicable to sms and facebook-messenger type Bindings as the data format is fixed.

  • CredentialSid string

    The SID of the Credential resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applies to only apn, fcm, and gcm type Bindings.

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

  • Endpoint string

    Deprecated.

Responses

  • 201 application/json

    Created

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

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

      The unique string that we created to identify the Binding resource.

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

    • account_sid string | null

      The SID of the Account that created the Binding resource.

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

    • service_sid string | null

      The SID of the Service the resource is associated with.

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

    • credential_sid string | null

      The SID of the Credential resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applicable only to apn, fcm, and gcm type Bindings.

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

    • date_created string(date-time) | null

      The date and time in GMT when the resource was created specified in RFC 2822 format.

    • date_updated string(date-time) | null

      The date and time in GMT when the resource was last updated specified in RFC 2822 format.

    • notification_protocol_version string | null

      The protocol version to use to send the notification. This defaults to the value of default_xxxx_notification_protocol_version in the Service for the protocol. The current version is "3" for apn, fcm, and gcm type Bindings. The parameter is not applicable to sms and facebook-messenger type Bindings as the data format is fixed.

    • endpoint string | null

      Deprecated.

    • identity string | null

      The identity value that uniquely identifies the resource's User within the Service. Up to 20 Bindings can be created for the same Identity in a given Service.

    • binding_type string | null

      The transport technology to use for the Binding. Can be: apn, fcm, gcm, sms, or facebook-messenger.

    • address string | null

      The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format.

    • tags array[string] | null

      The list of tags associated with this Binding. Tags can be used to select the Bindings to use when sending a notification. Maximum 20 tags are allowed.

    • url string(uri) | null

      The absolute URL of the Binding resource.

POST /v1/Services/{ServiceSid}/Bindings
curl \
 --request POST 'https://notify.twilio.com/v1/Services/{ServiceSid}/Bindings' \
 --user "username:password" \
 --header "Content-Type: application/x-www-form-urlencoded" \
 --data 'Tag=tag&Address=address&Endpoint=endpoint&Identity=24987039&BindingType=apn&CredentialSid=CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&NotificationProtocolVersion=notification_protocol_version'
Request example
{"Tag"=>["tag"], "Address"=>"address", "Endpoint"=>"endpoint", "Identity"=>"24987039", "BindingType"=>"apn", "CredentialSid"=>"CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "NotificationProtocolVersion"=>"notification_protocol_version"}
Response examples (201)
{
  "sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "tags": [
    "26607274"
  ],
  "links": {
    "user": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/24987039"
  },
  "address": "a7c658f4111ec4ff5a1a647f9d0edd819025b9f20522d2fae897049f32873e73",
  "endpoint": "26607274",
  "identity": "24987039",
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "binding_type": "apn",
  "date_created": "2015-07-30T20:00:00Z",
  "date_updated": "2015-07-30T20:00:00Z",
  "credential_sid": null,
  "notification_protocol_version": "3"
}