Sync Webhooks
When creating a service instance, a user can register a webhook URL. This URL will be called for any of the events generated by the client SDK or the REST API.
Twilio can send your web application an HTTP request when certain events happen, such as an incoming text message to one of your Twilio phone numbers. These requests are called webhooks, or status callbacks. For more, check out our guide to Getting Started with Twilio Webhooks. Find other webhook pages, such as a security guide and an FAQ in the Webhooks section of the docs.
Common Request Parameters
The incoming request for all events will contain the following common parameters:
パラメーター | 概要 |
---|---|
AccountSid | ユーザーの Twilio アカウント ID です。アカウント ID は 34 文字で、必ず AC から始まります。 |
エンドポイントID | The server-assigned EndpointId for the Sync client that generated the event. EndpointId is generated by Twilio gateways. EndpointId is not present for the REST API initiated webhooks. |
EventType | An id specifying the event that was generated (e.g. document_created ). See below for a complete list. |
Identity | The username/identity of the user that generated the event. Identity is originally supplied in the client authentication token. If the webhook is initiated by the REST API, Identity="system". |
Service SID | The unique id for the service instance. |
Document Events
document_created
: A new document has been created.document_updated
: Existing document has been updated.document_removed
: Document has been deleted.
Document Event Request Parameters
パラメーター | 概要 |
---|---|
DocumentData | The data for the document as JSON. Not included for the document_removed event. |
DocumentRevision | An integer representing the revision of the document. |
DocumentSid | The document id. It is 34 characters long, and always starts with the letters ET. |
DocumentUniqueName | The unique name of the document. |
List Events
list_created
: A new list collection has been created.list_removed
: List collection has been deleted entirely.
List Event Request Parameters
パラメーター | 概要 |
---|---|
ListRevision | An integer representing the revision of the list. |
ListSid | The list id. It is 34 characters long, and always starts with the letters ES. |
ListUniqueName | The unique name of the list. |
List Item Events
list_item_added
: A new item has been added to existing list collection.list_item_updated
: Existing item has been updated in the list collection.list_item_removed
: Item has been removed from the list collection.
List Item Event Request Parameters
パラメーター | 概要 |
---|---|
EventId | A sequence number representing the order of occurrence for the list item event. |
ItemData | The data for the list item as JSON. Not included for the list_item_removed event. |
ItemIndex | The index of the item in the list that was added, updated, or removed. |
ItemRevision | An integer representing the revision of the list item. Not included for the list_item_removed event. |
ListRevision | An integer representing the revision of the list. |
ListSid | The list id. It is 34 characters long, and always starts with the letters ES. |
ListUniqueName | The unique name of the list. |
Map Events
map_created
: A new map collection has been created.map_removed
: Map collection has been deleted entirely.
Map Event Request Parameters
パラメーター | 概要 |
---|---|
MapRevision | An integer representing the revision of the map. |
MapSid | The map id. It is 34 characters long, and always starts with the letters MP. |
MapUniqueName | The unique name of the map. |
Map Item Events
map_item_added
: A new item has been added to existing map collection.map_item_updated
: Existing item has been updated in the map collection.map_item_removed
: Item has been removed from the map collection.
Map Item Event Request Parameters
パラメーター | 概要 |
---|---|
EventId | A sequence number representing the order of occurrence for the map item event. |
ItemData | The data for the map item as JSON. Not included for the map_item_removed event. |
ItemKey | The key of the item in the map that was added, updated, or removed. |
ItemRevision | An integer representing the revision of the map item. Not included for the map_item_removed event. |
MapRevision | An integer representing the revision of the map. |
MapSid | The map id. It is 34 characters long, and always starts with the letters MP. |
MapUniqueName | The unique name of the map. |
Reachability Events
endpoint_connected
: A new client endpoint has connected to Sync. This event takes place whenever an application running Sync iOS, Android or JS SDK establishes a live persistent connection with Sync service with a valid authentication token.endpoint_disconnected
: An online client endpoint has been disconnected from Sync. This event may take place for a number of different reasons:- Application running Sync iOS, Android or JS SDK was shut down gracefully or was switched to background mode.
- Application lost connectivity to Internet, and service dropped an unresponsive connection eventually.
- First person authentication token expired and was not refreshed timely.
- Twilio gateway services have received a software update or got rebalanced.
- Reachability webhooks
endpoint_connected
&endpoint_disconnected
do not containDateCreated
property. This property does not represent the date when the resource was created, but when the webhook was created.
Note: Sync is rebalancing connections every hour, which also triggers the endpoint_disconnected
-> endpoint_connected
cycle as a side effect. All SDKs will automatically re-establish connectivity after rebalancing and replay any missed events, thus applications should not notice any impact of such behavior.
Reachability Event Request Parameters
パラメーター | 概要 |
---|---|
EventId | A sequence number (positive integer) representing the actual order of reachability events. A larger event ID means a more recent event, within the scope of a single identity. |
IsIdentityOnline | A boolean that shows if the identity is online or offline when a reachability event is emitted. If set to true, the supplied identity has one or more active connections. Note: the identity could have multiple endpoints connected, represented by different EndpointId's on various transports (i.e. websocket and MQTT). |
ヘルプが必要ですか?
誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。