Message status and interactions

Messages go through a life-cycle when being processed; life-cycle events provide an indication of the current status a message has; sending_failed or delivered are both examples of messages' status events.

Once a message is successfully delivered to its intended receiver, it may (based on the service and condition) generate associated interactions; opened and reported-as-spam are both examples of message interactions.

Message Lifecycle Events

You can create a webhook subscription to listen to channel message events (see API details here)

Channels supports two message lifecycle event webhook types:

  • <channel>.inbound

  • <channel>.outbound

<channel>.inbound

This event is used to receive incoming messages.

The message status can be:

  • delivered

    • When an incoming message is created with status delivered

The message direction will be:

  • incoming

This event is available for the following channels:

  • sms

  • whatsapp

  • email

  • line

  • instagram (including comments and mentions)

  • facebook

  • line

  • viber

  • linkedin

  • tiktok

  • apple business chat

  • telegram

Filter channel ID

By default, when creating a subscription without specifying any filter, you are going to receive all incoming messages for all channels of that platform e.g WhatsApp

Is it possible to add filters to only receive events for a specific channel ID .

For each subscription, it is only possible to add one channelId filter.

Example event

{
  "service": "channels",
  "event": "<channel>.inbound",
  "url": "http://site",
  "signingKey": "key",
  "eventFilters": [
    {
      "key": "channelId",
      "value": "<id>"
    }
  ]
}
Property
Description
Example value

service

The MEP service which generates the event

channels

event

The specific event you are subscribing too. For channels events are scoped to all channels for a specific platform e.g. WhatsApp

whatsapp.inbound

url

The webhook endpoint

https://site

signingKey

A value that will be used to validate a webhook

key

eventFilters[]

Event filters are inclusive, which means you will only get events for filters you add. If you do not add a filter you will get all events (except where you have other webhooks with an explicit filter).

{ "key": "channelId", "value": "<id>" }

Example payload

{
  "service": "channels",
  "event": "whatsapp.inbound",
  "payload": {
    "id": "404544c5-9920-45f1-8990-0855634ab7ac",
    "channelId": "52ad151f-f7b4-46f9-a5c6-d3318e650c84",
    "sender": {
      "contact": {
        "id": "d4e8935a-5f48-45a5-95a5-ee7ba1e2c5b4",
        "identifierKey": "phonenumber",
        "identifierValue": "+3511111111"
      }
    },
    "receiver": {
      "connector": {
        "id": "60bf59d6-fc6f-4511-89c4-75d9127d7a7c",
        "identifierValue": ""
      }
    },
    "body": {
      "type": "text",
      "text": {
        "text": "Test"
      }
    },
    "meta": {
      "extraInformation": {
        "timestamp": "1702496037"
      }
    },
    "reference": "",
    "parts": [
      {
        "platformReference": "wamid.HBgMMzUxOTE0MjYyNTM1FQIAEhggQUMzODQyNUY1MDlDQkU1QjJGNTM3RDlENjg0OTJGMDgA"
      }
    ],
    "status": "delivered",
    "reason": "",
    "direction": "incoming",
    "lastStatusAt": "2023-12-13T19:34:01.858Z",
    "createdAt": "2023-12-13T19:34:01.858Z",
    "updatedAt": "2023-12-13T19:34:02.063Z"
  }
}

<channel>.outbound

This event is used to receive status updates for outgoing messages. The following statuses are currently supported.

The message status can be:

  • accepted

    • When an outgoing message has been accepted by the channels, API and will be processed by Bird

  • sent

    • When an outgoing message changes status to sent meaning it was processed successfully and handed to a downstream entity or carrier for delivery.

sent is a temporary status that will be updated to either final failure or delivery once carrier-generated events are received and processed. Many carriers process status reports asynchronously, so while a message marked as SENT may have already been delivered, the delivery confirmation hasn't yet been received from the downstream carrier."

Email messages with multiple recipients (e.g. one recipient in "To" and another in "Bcc") have sent as a final status, otherwise it'd cause ambiguity if it gets successfully delivered to one recipient but not the other.

  • sending_failed

    • When an outgoing message changes status to sending_failed. This indicates a failure in the Bird platform, and the message was never submitted to a downstream carrier for delivery.

  • delivered

    • When an outgoing message changes status to delivered. Delivered is a final status and indicates a message has reached its final destination.

Downstream carriers handle delivery reports differently. A DELIVERED status might mean the message reached the final recipient or just the last delivery network. Not all platforms or carriers provide reports for delivery to the final recipient; final network reports are standard. In such cases, the message could still be blocked or dropped during the "last mile" to the recipient.

  • delivery_failed

    • When an outgoing message changes status to delivery_failed following a failure to deliver downstream of Bird's platform.

The message direction will be:

  • outgoing

This event is available for the following channels:

  • sms

  • whatsapp

  • email

  • line

  • instagram (including comments and mentions)

  • facebook

  • line

  • viber

  • linkedin

  • tiktok

  • apple business chat

  • telegram

Filter channel ID

By default, when creating a subscription without specifying any filter, you are going to receive all incoming messages for all channels of that platform e.g WhatsApp

Is it possible to add filters to only receive events for a specific channel ID .

For each subscription, it is only possible to add one channelId filter.

Filter messageStatus

For each subscription, it is possible to add none or multiple filters for the messageStatus.

If the filter is not added, all statuses will be sent. If multiple status filters are added, a webhook will be sent everytime a specified status value is matched.

Example

{
  "service": "channels",
  "event": "<channel>.outbound",
  "url": "http://site",
  "signingKey": "key",
  "eventFilters": [
    {
      "key": "channelId",
      "value": "<id>"
    },
    {
      "key": "messageStatus",
      "value": "delivered"
    }
  ]
}
Property
Description
Example value

service

The MEP service which generates the event

channels

event

The specific event you are subscribing too. For channels events are scoped to all channels for a specific platform e.g. WhatsApp

whatsapp.outbound

url

The webhook endpoint

https://site

signingKey

A value that will be used to validate a webhook

key

eventFilters[]

Event filters are inclusive, which means you will only get events for filters you add. If you do not add a filter you will get all events (except where you have other webhooks with an explicit filter).

{ "key": "channelId", "value": "<id>" }, { "key": "messageStatus", "value": "delivered" }

Example payload

Here you can find an example of a WhatsApp event

{
  "service": "channels",
  "event": "whatsapp.outbound",
  "payload": {
    "id": "4a53460b-1728-4573-bd78-ea1c041a46e6",
    "channelId": "52ad151f-f7b4-46f9-a5c6-d3318e650c84",
    "sender": {
      "connector": {
        "id": "60bf59d6-fc6f-4511-89c4-75d9127d7a7c",
        "identifierValue": "104541186076935"
      }
    },
    "receiver": {
      "contacts": [
        {
          "id": "d4e8935a-5f48-45a5-95a5-ee7ba1e2c5b4",
          "identifierKey": "phonenumber",
          "identifierValue": "+3111111111",
          "type": "to"
        }
      ]
    },
    "reference": "LIbtsEzhedLUt0NwATtN3E",
    "status": "delivered",
    "reason": "",
    "lastStatusAt": "2023-12-13T12:22:33.781Z",
    "createdAt": "2023-12-13T12:22:33.781Z",
    "updatedAt": "2023-12-13T12:22:33.781Z"
  }
}

sms.outbound events also include the message body in each webhook except when sent as a part of a campaign, when the template ID will be used instead. For other channels, the body is not included

Here an SMS example

json
{
  "id": "9bbd4d52-0000-0000-0000-a663818dffc9",
  "channelId": "a65a0983-0000-0000-0000-1d4c0304ebf6",
  "sender": {
    "connector": {
      "id": "2f117d64-0000-0000-0000-a318203f6c7f",
      "identifierValue": "+46790000000"
    }
  },
  "receiver": {
    "contacts": [
      {
        "id": "8f0feae0-0000-0000-0000-43f102b384c5",
        "identifierKey": "phonenumber",
        "identifierValue": "+590690000000",
        "countryCode": "GP"
      }
    ]
  },
  "body": {
    "type": "text",
    "text": {
      "text": "Hello World !"
    }
  },
  "meta": {},
  "reference": "",
  "parts": [
    {
      "platformReference": "9bbd4d52-0000-0000-0000-a663818dffc9:19c8b0b2-4453-4bd4-a899-062cbbde1a45"
    }
  ],
  "status": "delivered",
  "reason": "",
  "direction": "outgoing",
  "chargeableUnits": 1,
  "lastStatusAt": "2024-04-15T03:37:19.92Z",
  "createdAt": "2024-04-15T03:37:16.441Z",
  "updatedAt": "2024-04-15T03:37:19.92Z"
}

Message Interactions

In addition to message lifecycle events, specific customer actions on a message also lead to message interactions.

To check if a message has any interactions, you can query a specific message using the following endpoint

List message interactions

List message interactions

GET/workspaces/{workspaceId}/channels/{channelId}/messages/{messageId}/interactions
Authorization
Path parameters
workspaceId*string (uuid)

The ID of the workspace

messageId*string (uuid)

The ID for a message

channelId*string (uuid)

The ID for a channel

Response

OK

Body
resultsarray of ChannelMessageInteraction
Request
const response = await fetch('/workspaces/{workspaceId}/channels/{channelId}/messages/{messageId}/interactions', {
    method: 'GET',
    headers: {
      "Authorization": "Bearer jwt"
    },
});
const data = await response.json();
Response
{
  "results": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "messageId": "123e4567-e89b-12d3-a456-426614174000",
      "channelId": "123e4567-e89b-12d3-a456-426614174000",
      "platformId": "text",
      "type": "clicked",
      "messageReference": "text",
      "messagePartsCount": 0,
      "messageTags": [
        "text"
      ],
      "receiver": {
        "connector": {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "identifierValue": "text",
          "annotations": {
            "name": "text"
          },
          "types": [
            "text"
          ]
        }
      },
      "createdAt": "2024-12-21T11:55:27.338Z",
      "details": "text",
      "context": {
        "id": "text",
        "type": "text",
        "tags": [
          "text"
        ]
      },
      "metadata": {
        "link": {
          "name": "text",
          "url": "text"
        },
        "button": {
          "payload": "text"
        },
        "reaction": {
          "emoji": "text",
          "action": "text"
        },
        "prefetched": false
      }
    }
  ]
}

The following interactions are currently possible

Interaction
Description
Supported platforms

read

A user has read a message

WhatsApp, Facebook, Instagram, Line

opened

A user has opened a message

Email

clicked

A user has clicked a link or clicked a quick reply button

Email, WhatsApp, Facebook, Instagram, Line

reported-as-spam

A user has reported a message as spam

Email

unsubscribe-request

A user has requested to unsubscribe from messages

Email

delete-request

A user has deleted the recieved message

-

reaction

A user has reacted (or unreacted) to a message with an emoji

WhatsApp, Facebook, Instagram

invalid

Invalid status

-

<channel>.interaction

This event is used to receive interactions on a message.

The interaction type can be:

  • read

  • opened

  • clicked

  • reported-as-spam

  • unsubscribe-request

  • delete-request

  • reaction

This event is available for the following channels:

  • sms

  • whatsapp

  • email

  • line

  • instagram (including comments and mentions)

  • facebook

  • line

  • viber

  • telegram

By default, when creating a subscription without specifying any filter, you are going to receive all interaction events for all channels of that platform.

Is possible to add filters to only receive interaction for a specific channel ID and specific interaction type.

Filter channel ID

By default, when creating a subscription without specifying any filter, you are going to receive all incoming messages for all channels of that platform e.g WhatsApp

Is it possible to add filters to only receive events for a specific channel ID .

For each subscription, it is only possible to add one channelId filter.

Filter by interactionType

For each subscription, it is possible to add none or multiple filters for the interactionType.

If the filter is not added, all interactions will be sent. If multiple interaction filters are added, a webhook will be sent everytime a specified interaction type is matched

Example

{
  "service": "channels",
  "event": "<channel>.interaction",
  "url": "http://site",
  "signingKey": "key",
  "eventFilters": [
    {
      "key": "channelId",
      "value": "<id>"
    },
    {
      "key": "interactionType",
      "value": "reaction"
    },
    {
      "key": "interactionType",
      "value": "read"
    }
  ]
}
Property
Description
Example value

service

The MEP service which generates the event

channels

event

The specific event you are subscribing too. For channels events are scoped to all channels for a specific platform e.g. WhatsApp

whatsapp.outbound

url

The webhook endpoint

https://site

signingKey

A value that will be used to validate a webhook

key

eventFilters[]

Event filters are inclusive, which means you will only get events for filters you add. If you do not add a filter you will get all events (except where you have other webhooks with an explicit filter).

{ "key": "channelId", "value": "{id>" }, { "key": "interactionType", "value": "reaction" }, { "key": "interactionType", "value": "read" }

Example payload

{
  "service": "channels",
  "event": "whatsapp.interaction",
  "payload": {
    "id": "f28b8a73-99d2-11ee-9479-0a58a9feac02",
    "type": "read",
    "createdAt": "2023-12-13T16:16:16Z",
    "messageId": "9c9175e7-63d7-45ae-b945-d21dfea942be",
    "channelId": "199f0353-fcb8-41b2-afd6-614c6baf3850",
    "platformId": "",
    "messageReference": "wamid.HBgLMzE2NTA1MzQyNTkVAgARGBJCMTdBQjdDRjAzNkE3QUIzMEMA",
    "messagePartsCount": 1,
    "receiver": {
      "contacts": [
        {
          "id": "00000000-0000-0000-0000-000000000000",
          "identifierKey": "phonenumber",
          "identifierValue": "311111111"
        }
      ]
    }
  }
}

Last updated