メニュー

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Binding Resource

The Binding resource binds an identity to the address used by a notification channel. For example, iOS push notifications use an APNS device token for their address and SMS uses a phone number. Creating a Binding allows you to send notifications by referring to an identity rather than a specific device. You can create up to 20 Bindings with the same identity in a given Service.

You can add tags to a Binding that describe related Bindings. For example, you can add a tag to the Bindings of a user's preferred devices and then refer to that tag to notify them on only their preferred devices. Read more about Sending Notifications.

Do not use Personally Identifiable Information (PII) for identity.

The systems that process this parameter assume it does not contain PII.

You should use a GUID or other pseudonymized identifier for identity instead of PII such as a person's name, home address, email or phone number. If you identify your users with PII, we recommend creating a pseudonymized identifier from their PII, for example by hashing or encrypting it, before you use it for identity.

You can read more about how we process your data in our privacy policy.

Make sure you have consent from users before storing their device's address.

It’s a good practice to obtain your end users’ consent before you send them messages and some jurisdictions might require it by law.

We recommend that you consult with your legal counsel to make sure that your communications comply with all applicable laws.

To make sure your messages reach the right people, you should make sure that they have given you their consent to send them messages and that their contact information is current.

Check out the Twilio Marketplace for Add-ons from our partners that can help you keep your database up to date.

Address for push notifications

While the address of an SMS message is the phone number, the address to use for push notifications is obtained by your client-side mobile app. Learn how to:

Binding properties

Names in Node.js format
sid
sid<BS> Not PII

accountSid
sid<AC> Not PII

serviceSid
sid<IS> Not PII

credentialSid
sid<CR> Not PII

The unique identifier (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.

dateCreated
date_time<iso8601> Not PII

dateUpdated
date_time<iso8601> Not PII

notificationProtocolVersion
文字列 Not PII

The version of the protocol (data format) used to send the notification. This defaults to the value of DefaultXXXNotificationProtocolVersion 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.

endpoint
文字列 Not PII

DEPRECATED*

identity
文字列 PII MTL: 120 DAYS

The Identity to which this Binding belongs to. Identity is defined by your application. Up to 20 Bindings can be created for the same Identity in a given Service.

bindingType
文字列 Not PII

バインディングの種類です。 使用する転送テクノロジーを決定します。 取りうる値はapnfcmgcmsms、およびfacebook-messengerです。

address
文字列 PII MTL: 120 DAYS

チャネル固有のアドレスです。 APNSについては、デバイストークンです。 FCMとGCMについてはレジストレーショントークンです。 SMSでは、E.164形式の電話番号です。 Facebook Messengerでは、ユーザーのMessenger IDまたはE.164形式の電話番号です。

tags

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
url Not PII

links
uri_map Not PII

Endpoint (DEPRECATED)

We deprecated endpoint and trust the push-channel provider (such as APNS or Firebase) to let us know when an app has changed or invalidated the device token used as the address.

The endpoint property was used to uniquely identify push notification Bindings when the app installation's address changed, such as when the device token changed in an iOS app. You can still include an Endpoint parameter when you create a Binding; however, it will be ignored.

Create a Binding resource

post
https://notify.twilio.com/v1/Services/{ServiceSid}/Bindings
パラメーター
Names in None format
identity
必須
post 文字列 PII MTL: 120 DAYS

The Identity to which this Binding belongs to. Identity is defined by your application. Up to 20 Bindings can be created for the same Identity in a given Service.

binding_type
必須
post enum:binding_type Not PII

バインディングの種類です。 使用する転送テクノロジーを決定します。 取りうる値はapnfcmgcmsms、およびfacebook-messengerです。

address
必須
post 文字列 PII MTL: 120 DAYS

チャネル固有のアドレスです。 APNSについては、デバイストークンです。 FCMとGCMについてはレジストレーショントークンです。 SMSでは、E.164形式の電話番号です。 Facebook Messengerでは、ユーザーのMessenger IDまたはE.164形式の電話番号です。

tag
オプション
post string[] Not PII

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.

notification_protocol_version
オプション
post 文字列 Not PII

The version of the protocol (data format) used to send the notification. This defaults to the value of DefaultXXXNotificationProtocolVersion 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.

credential_sid
オプション
post sid<CR> Not PII

The unique identifier (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.

endpoint
オプション
post 文字列 Not PII

DEPRECATED*

        
        
        
        

        Existing Bindings with the same Address are replaced

        If the Service already has a Binding with the same Address as specified in the create request, the Binding being created replaces the existing Binding.

        The new Binding replaces the existing one under these conditions to prevent leaking notifications between users when, for example, a new user logs into your app on a device that has already been registered to another user.

        To register the same Address twice, such as when someone is a buyer and a seller at the same time in a marketplace, we recommend creating separate Service instances, such as one for buyers and one for sellers.

        Endpoint (DEPRECATED)

        We deprecated endpoint and trust the push-channel provider (such as APNS or Firebase) to let us know when an app has changed or invalidated the device token used as the address.

        The endpoint property was used to uniquely identify push notification Bindings when the app installation's address changed, such as when the device token changed in an iOS app. You can still include an Endpoint parameter when you create a Binding; however, it will be ignored.

        Read multiple Binding resources

        GET
        https://notify.twilio.com/v1/Services/{ServiceSid}/Bindings
        パラメーター
        Names in None format
        start_date
        オプション
        GET date<iso8601> Not PII

        所定の日付以降に作成されたバインディングだけをリストします。フォーマット形式は YYYY-MM-DD です。UTC で表記する必要があります。

        end_date
        オプション
        GET date<iso8601> Not PII

        所定の日付以前に作成されたバインディングだけをリストします。フォーマット形式は YYYY-MM-DD です。UTC で表記する必要があります。

        identity
        オプション
        GET string[] PII MTL: 120 DAYS

        アイデンティティーの指定されたバインディングのみが一覧されます。

        tag
        オプション
        GET string[] Not PII

        指定されたタグすべてを持つBindingのみ一覧します。 下記の暗黙のタグが利用可能です: all(すべて)、apn(APN)、gcm(GCM)、sms(SMS)、facebook-messenger(Facebook Messanger) 最大5つのタグが使用可能です。

              
              
              
              

              Note that no more than 50 Bindings are returned at a time.

              Delete a Binding resource

              削除する
              https://notify.twilio.com/v1/Services/{ServiceSid}/Bindings/{Sid}
                    
                    
                    
                    
                    Rate this page:

                    ヘルプが必要ですか?

                    We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.