Skip to contentSkip to navigationSkip to topbar
On this page

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. To enable webhooks from API triggered events, set the webhooks_from_rest_enabled parameter to true in your Sync service properties.

(information)

Info

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

common-request-parameters page anchor

The incoming request for all events will contain the following common parameters:

ParameterDescription
AccountSidYour Twilio account id. It is 34 characters long, and always starts with the letters AC.
EndpointIdThe 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.
EventTypeAn id specifying the event that was generated (e.g. document_created). See below for a complete list.
IdentityThe 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".
ServiceSidThe unique id for the service instance.

  • 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

document-event-request-parameters page anchor
ParameterDescription
DocumentDataThe data for the document as JSON. Not included for the document_removed event.
DocumentRevisionAn integer representing the revision of the document.
DocumentSidThe document id. It is 34 characters long and always starts with the letters ET.
DocumentUniqueNameThe unique name of the document.

  • list_created: A new list collection has been created.
  • list_removed: List collection has been deleted entirely.

List Event Request Parameters

list-event-request-parameters page anchor
ParameterDescription
ListRevisionAn integer representing the revision of the list.
ListSidThe list id. It is 34 characters long, and always starts with the letters ES.
ListUniqueNameThe unique name of the list.

  • 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

list-item-event-request-parameters page anchor
ParameterDescription
EventIdA sequence number representing the order of occurrence for the list item event.
ItemDataThe data for the list item as JSON. Not included for the list_item_removed event.
ItemIndexThe index of the item in the list that was added, updated, or removed.
ItemRevisionAn integer representing the revision of the list item. Not included for the list_item_removed event.
ListRevisionAn integer representing the revision of the list.
ListSidThe list id. It is 34 characters long, and always starts with the letters ES.
ListUniqueNameThe unique name of the list.

  • map_created: A new map collection has been created.
  • map_removed: Map collection has been deleted entirely.

Map Event Request Parameters

map-event-request-parameters page anchor
ParameterDescription
MapRevisionAn integer representing the revision of the map.
MapSidThe map id. It is 34 characters long, and always starts with the letters MP.
MapUniqueNameThe unique name of the map.

  • 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

map-item-event-request-parameters page anchor
ParameterDescription
EventIdA sequence number representing the order of occurrence for the map item event.
ItemDataThe data for the map item as JSON. Not included for the map_item_removed event.
ItemKeyThe key of the item in the map that was added, updated, or removed.
ItemRevisionAn integer representing the revision of the map item. Not included for the map_item_removed event.
MapRevisionAn integer representing the revision of the map.
MapSidThe map id. It is 34 characters long, and always starts with the letters MP.
MapUniqueNameThe unique name of the map.

  • 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 contain DateCreated 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

reachability-event-request-parameters page anchor
ParameterDescription
EventIdA 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.
IsIdentityOnlineA 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).

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.