דלג לתוכן הראשי
Subscribe to receive a notification when an outgoing message is delivered or fails. This subscription includes only statuses 2, 4, and 5. The messageStatus field contains one of: Event name: messageDeliveredOrFailed Required token scopes:
  • Create scenarios
  • Manage scenarios on behalf of user
see Authentication

Subscribe

Send the body below to Import Subscription. You only need to change:
  • url (required) - Located under data.actions[0].params.url. Replace {{yourWebhookURL}} with the destination URL that should receive the events.
  • asStatus - Keep "active" to enable the subscription immediately, or "inactive" to save it as an inactive revision.
Import body
A 201 response returns your new subscription - save its _id to manage it later. You can also add an optional authorUid root field (a Texter user UID) to attribute the subscription to a specific user.

Payload

When the event fires, your URL receives an HTTP POST with eventName: "messageDeliveredOrFailed" and the following eventData:
Chat
The chat associated with the message, excluding crmData and previousBotSession. See the Chat object for the remaining fields.
string | null
The Texter message _id matched to externalId[0]. This is the same messageId returned by Send Template Message. Returns null when no match is found among the latest 5 outgoing messages.
number
The new status - see the status codes table above.
string | null
Error message - only present when status is 4 or 5, otherwise null.
number
When the status changed (Unix epoch milliseconds).
string[]
Unique IDs assigned to the message(s) by the external provider.
Example payload

How to identify the message

Use messageId to match this event to the messageId returned by Send Template Message. The subscription searches the latest 5 outgoing messages in the chat. It selects the message whose channelInfo.id equals the first value in externalId. If no match exists, messageId is null; the status webhook is still sent. externalId keeps all provider IDs from the event. The single messageId identifies only externalId[0]. For older messages or additional IDs, use Get Messages of a Chat, page through the results, and match each channelInfo.id.
Existing subscriptions keep their saved scenario. Update your subscription to use this template before expecting the messageId field and the chat-field omissions.

Manage this subscription