Events

Overview

Twilio Communications API provides event types for tracking message delivery, failures, reads, and operational status. You can subscribe to these events to receive real-time notifications and automate workflows based on message outcomes.

Operation events

Operation processing

This event notifies you when Twilio is processing messages in a specific operation.

Subscribe to this event to monitor the progress of a bulk message send.

  • Subscription event type: com.twilio.comms-api.operation.processing
  • Event schema: https://events-schemas.twilio.com/CommsApi.OperationProcessing/2

Example event payload:

1{
2 "$id": "https://events-schemas.twilio.com/CommsApi.OperationProcessing/2",
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "type": "object",
5 "title": "Operations Processing Event Schema",
6 "description": "Indicates that messages in an operation are being processed.",
7 "required": [],
8 "properties": {
9 "operation_id": {
10 "type": "string",
11 "description": "Unique identifier for the operation"
12 }
13 },
14 "additionalProperties": false
15}

Operation completed

This event notifies you when Twilio has finished processing all messages in a specific operation.

  • Subscription event: com.twilio.comms-api.operation.completed
  • Event schema: https://events-schemas.twilio.com/CommsApi.OperationCompleted/2

Example event payload:

1{
2 "$id": "https://events-schemas.twilio.com/CommsApi.OperationCompleted/2",
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "type": "object",
5 "title": "Operation Completed Event Schema",
6 "description": "Indicates that messages in an operation are done processing.",
7 "required": [],
8 "properties": {
9 "operation_id": {
10 "type": "string",
11 "description": "Unique identifier for the operation"
12 }
13 },
14 "additionalProperties": false
15}

Operation scheduled

This event notifies you when Twilio has scheduled messages in a specific operation for future delivery.

  • Subscription event: com.twilio.comms-api.operation.scheduled
  • Event schema: https://events-schemas.twilio.com/CommsApi.OperationScheduled/2

Example event payload:

1{
2 "$id": "https://events-schemas.twilio.com/CommsApi.OperationScheduled/2",
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "type": "object",
5 "title": "Operations scheduled Event Schema",
6 "description": "Indicates that messages in an operation are being scheduled.",
7 "required": [],
8 "properties": {
9 "operation_id": {
10 "type": "string",
11 "description": "Unique identifier for the operation"
12 }
13 },
14 "additionalProperties": false
15}

Message events

Message queued

This event notifies you when Twilio has accepted a message and placed it in the queue for processing.

  • Subscription event: com.twilio.comms-api.message.queued
  • Event schema: https://events-schemas.twilio.com/CommsApi.MessageQueued/3

Example event payload:

1{
2 "$id": "https://events-schemas.twilio.com/CommsApi.MessageQueued/3",
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "type": "object",
5 "title": "Message Queued Event Schema",
6 "description": "Indicates that the message has been accepted by the system and is waiting to be processed.",
7 "required": [],
8 "properties": {
9 "account_sid": {
10 "type": "string",
11 "description": "Twilio Account SID"
12 },
13 "operation_id": {
14 "type": "string",
15 "description": "Unique identifier for the operation"
16 },
17 "message_id": {
18 "type": "string",
19 "description": "Unique identifier for the message record"
20 },
21 "downstream_id": {
22 "type": "string",
23 "description": "Identifier for the downstream system where the message was queued"
24 },
25 "attempt": {
26 "type": "string",
27 "description": "Attempt number for the operation"
28 },
29 "from": {
30 "type": "object",
31 "description": "Object containing the source of the message",
32 "additionalProperties": false,
33 "properties": {
34 "id": {
35 "type": "string",
36 "description": "Unique identifier for the source"
37 },
38 "address": {
39 "type": "string",
40 "description": "Address of the source"
41 },
42 "channel": {
43 "type": "string",
44 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
45 }
46 }
47 },
48 "to": {
49 "type": "object",
50 "description": "Object containing the destination of the message",
51 "additionalProperties": false,
52 "properties": {
53 "id": {
54 "type": "string",
55 "description": "Unique identifier for the destination"
56 },
57 "address": {
58 "type": "string",
59 "description": "Address of the destination"
60 },
61 "channel": {
62 "type": "string",
63 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
64 }
65 }
66 },
67 "tags": {
68 "type": "object",
69 "additionalProperties": {
70 "type": "string"
71 },
72 "description": "Array of tag objects containing key-value pairs"
73 }
74 },
75 "additionalProperties": false
76}

Message sent

This event notifies you when Twilio has successfully transmitted a message to the carrier.

  • Subscription event: com.twilio.comms-api.message.sent
  • Event schema: https://events-schemas.twilio.com/CommsApi.MessageSent/4

Example event payload:

1{
2 "$id": "https://events-schemas.twilio.com/CommsApi.MessageSent/4",
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "type": "object",
5 "title": "Message Sent Event Schema",
6 "description": "Indicates a successful transmission of a message to the carrier.",
7 "required": [],
8 "properties": {
9 "operation_id": {
10 "type": "string",
11 "description": "Unique identifier for the operation"
12 },
13 "message_id": {
14 "type": "string",
15 "description": "Unique identifier for the message record"
16 },
17 "attempt": {
18 "type": "string",
19 "description": "Attempt number for the operation"
20 },
21 "downstream_id": {
22 "type": "string",
23 "description": "Identifier for the downstream system where the message was sent"
24 },
25 "from": {
26 "type": "object",
27 "description": "Object containing the source of the message",
28 "additionalProperties": false,
29 "properties": {
30 "id": {
31 "type": "string",
32 "description": "Unique identifier for the source"
33 },
34 "address": {
35 "type": "string",
36 "description": "Address of the source"
37 },
38 "channel": {
39 "type": "string",
40 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
41 }
42 }
43 },
44 "to": {
45 "type": "object",
46 "description": "Object containing the destination of the message",
47 "additionalProperties": false,
48 "properties": {
49 "id": {
50 "type": "string",
51 "description": "Unique identifier for the destination"
52 },
53 "address": {
54 "type": "string",
55 "description": "Address of the destination"
56 },
57 "channel": {
58 "type": "string",
59 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
60 }
61 }
62 },
63 "tags": {
64 "type": "object",
65 "additionalProperties": {
66 "type": "string"
67 },
68 "description": "Array of tag objects containing key-value pairs"
69 }
70 },
71 "additionalProperties": false
72}

Message failed

This event notifies you when a message has failed to be sent or processed.

  • Subscription event: com.twilio.comms-api.message.failed
  • Event schema: https://events-schemas.twilio.com/CommsApi.MessageFailed/4

Example event payload:

1{
2 "$id": "https://events-schemas.twilio.com/CommsApi.MessageFailed/4",
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "type": "object",
5 "title": "Message Failed Event Schema",
6 "description": "Indicates that a message has failed to be sent or processed.",
7 "required": [],
8 "properties": {
9 "operation_id": {
10 "type": "string",
11 "description": "Unique identifier for the operation"
12 },
13 "message_id": {
14 "type": "string",
15 "description": "Unique identifier for the message record"
16 },
17 "attempt": {
18 "type": "string",
19 "description": "Attempt number for the operation"
20 },
21 "downstream_id": {
22 "type": "string",
23 "description": "Identifier for the downstream system where the message failed"
24 },
25 "error_code": {
26 "type": "string",
27 "description": "Error code associated with the failure"
28 },
29 "from": {
30 "type": "object",
31 "description": "Object containing the source of the message",
32 "additionalProperties": false,
33 "properties": {
34 "id": {
35 "type": "string",
36 "description": "Unique identifier for the source"
37 },
38 "address": {
39 "type": "string",
40 "description": "Address of the source"
41 },
42 "channel": {
43 "type": "string",
44 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
45 }
46 }
47 },
48 "to": {
49 "type": "object",
50 "description": "Object containing the destination of the message",
51 "additionalProperties": false,
52 "properties": {
53 "id": {
54 "type": "string",
55 "description": "Unique identifier for the destination"
56 },
57 "address": {
58 "type": "string",
59 "description": "Address of the destination"
60 },
61 "channel": {
62 "type": "string",
63 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
64 }
65 }
66 },
67 "tags": {
68 "type": "object",
69 "additionalProperties": {
70 "type": "string"
71 },
72 "description": "Array of tag objects containing key-value pairs"
73 }
74 },
75 "additionalProperties": false
76}

Message delivered

This event notifies you when a message has been successfully delivered to the recipient.

  • Subscription event: com.twilio.comms-api.message.delivered
  • Event schema: https://events-schemas.twilio.com/CommsApi.MessageDelivered/4

Example event payload:

1{
2 "$id": "https://events-schemas.twilio.com/CommsApi.MessageDelivered/4",
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "type": "object",
5 "title": "Message Delivered Event Schema",
6 "description": "Indicates that a message has been successfully delivered to the recipient.",
7 "required": [],
8 "properties": {
9 "operation_id": {
10 "type": "string",
11 "description": "Unique identifier for the operation"
12 },
13 "message_id": {
14 "type": "string",
15 "description": "Unique identifier for the message record"
16 },
17 "attempt": {
18 "type": "string",
19 "description": "Attempt number for the operation"
20 },
21 "downstream_id": {
22 "type": "string",
23 "description": "Identifier for the downstream system where the message was delivered"
24 },
25 "from": {
26 "type": "object",
27 "description": "Object containing the source of the message",
28 "additionalProperties": false,
29 "properties": {
30 "id": {
31 "type": "string",
32 "description": "Unique identifier for the source"
33 },
34 "address": {
35 "type": "string",
36 "description": "Address of the source"
37 },
38 "channel": {
39 "type": "string",
40 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
41 }
42 }
43 },
44 "to": {
45 "type": "object",
46 "description": "Object containing the destination of the message",
47 "additionalProperties": false,
48 "properties": {
49 "id": {
50 "type": "string",
51 "description": "Unique identifier for the destination"
52 },
53 "address": {
54 "type": "string",
55 "description": "Address of the destination"
56 },
57 "channel": {
58 "type": "string",
59 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
60 }
61 }
62 },
63 "tags": {
64 "type": "object",
65 "additionalProperties": {
66 "type": "string"
67 },
68 "description": "Array of tag objects containing key-value pairs"
69 }
70 },
71 "additionalProperties": false
72}

Message undelivered

This event notifies you when Twilio receives a delivery receipt indicating that the message was not delivered.

  • Subscription event: com.twilio.comms-api.message.undelivered
  • Event schema: https://events-schemas.twilio.com/CommsApi.MessageUndelivered/4

Example event payload:

1{
2 "$id": "https://events-schemas.twilio.com/CommsApi.MessageUndelivered/4",
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "type": "object",
5 "title": "Message Undelivered Event Schema",
6 "description": "Indicates that Twilio has received a delivery receipt indicating that the message was not delivered",
7 "required": [],
8 "properties": {
9 "operation_id": {
10 "type": "string",
11 "description": "Unique identifier for the operation"
12 },
13 "message_id": {
14 "type": "string",
15 "description": "Unique identifier for the message record"
16 },
17 "attempt": {
18 "type": "string",
19 "description": "Attempt number for the operation"
20 },
21 "downstream_id": {
22 "type": "string",
23 "description": "Identifier for the downstream system where the message was undelivered"
24 },
25 "error_code": {
26 "type": "string",
27 "description": "Error code associated with the failure"
28 },
29 "from": {
30 "type": "object",
31 "description": "Object containing the source of the message",
32 "additionalProperties": false,
33 "properties": {
34 "id": {
35 "type": "string",
36 "description": "Unique identifier for the source"
37 },
38 "address": {
39 "type": "string",
40 "description": "Address of the source"
41 },
42 "channel": {
43 "type": "string",
44 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
45 }
46 }
47 },
48 "to": {
49 "type": "object",
50 "description": "Object containing the destination of the message",
51 "additionalProperties": false,
52 "properties": {
53 "id": {
54 "type": "string",
55 "description": "Unique identifier for the destination"
56 },
57 "address": {
58 "type": "string",
59 "description": "Address of the destination"
60 },
61 "channel": {
62 "type": "string",
63 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
64 }
65 }
66 },
67 "tags": {
68 "type": "object",
69 "additionalProperties": {
70 "type": "string"
71 },
72 "description": "Array of tag objects containing key-value pairs"
73 }
74 },
75 "additionalProperties": false
76}

Message read

This event notifies you when a message, such as a WhatsApp message, has been read by the recipient.

  • Subscription event: com.twilio.comms-api.message.read
  • Event schema: https://events-schemas.twilio.com/CommsApi.MessageRead/4

Example event payload:

1{
2 "$id": "https://events-schemas.twilio.com/CommsApi.MessageRead/4",
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "type": "object",
5 "title": "Message Read Event Schema",
6 "description": "Schema for message read events. For example, when a whatsapp message is read by the recipient.",
7 "required": [],
8 "properties": {
9 "operation_id": {
10 "type": "string",
11 "description": "Unique identifier for the operation"
12 },
13 "message_id": {
14 "type": "string",
15 "description": "Unique identifier for the message record"
16 },
17 "attempt": {
18 "type": "string",
19 "description": "Attempt number for the operation"
20 },
21 "downstream_id": {
22 "type": "string",
23 "description": "Identifier for the downstream system where the message was sent"
24 },
25 "from": {
26 "type": "object",
27 "description": "Object containing the source of the message",
28 "additionalProperties": false,
29 "properties": {
30 "id": {
31 "type": "string",
32 "description": "Unique identifier for the source"
33 },
34 "address": {
35 "type": "string",
36 "description": "Address of the source"
37 },
38 "channel": {
39 "type": "string",
40 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
41 }
42 }
43 },
44 "to": {
45 "type": "object",
46 "description": "Object containing the destination of the message",
47 "additionalProperties": false,
48 "properties": {
49 "id": {
50 "type": "string",
51 "description": "Unique identifier for the destination"
52 },
53 "address": {
54 "type": "string",
55 "description": "Address of the destination"
56 },
57 "channel": {
58 "type": "string",
59 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
60 }
61 }
62 },
63 "tags": {
64 "type": "object",
65 "additionalProperties": {
66 "type": "string"
67 },
68 "description": "Array of tag objects containing key-value pairs"
69 }
70 },
71 "additionalProperties": false
72}

Message inbound

This event notifies you when an inbound message has been received, for example, when a user sends a reply via RCS or WhatsApp.

  • Subscription event: com.twilio.comms-api.message.inbound-received
  • Event schema: https://events-schemas.twilio.com/CommsApi.MessageInbound/2

Example event payload:

1{
2 "$id": "https://events-schemas.twilio.com/CommsApi.MessageInbound/2",
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "type": "object",
5 "title": "Message Inbound Event Schema",
6 "description": "Schema for message inbound events. For example, when a rcs message is received from a user.",
7 "required": [],
8 "properties": {
9 "operation_id": {
10 "type": "string",
11 "description": "Unique identifier for the operation"
12 },
13 "message_id": {
14 "type": "string",
15 "description": "Unique identifier for the message record"
16 },
17 "downstream_id": {
18 "type": "string",
19 "description": "Identifier for the downstream system where the message was sent"
20 },
21 "session_id": {
22 "type": "string",
23 "description": "Identifier for the session associated with the message"
24 },
25 "to": {
26 "type": "object",
27 "description": "Object containing the destination of the message",
28 "additionalProperties": false,
29 "properties": {
30 "id": {
31 "type": "string",
32 "description": "Unique identifier for the destination"
33 },
34 "address": {
35 "type": "string",
36 "description": "Address of the destination"
37 },
38 "channel": {
39 "type": "string",
40 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
41 }
42 }
43 },
44 "from": {
45 "type": "object",
46 "description": "Object containing the source of the message",
47 "additionalProperties": false,
48 "properties": {
49 "id": {
50 "type": "string",
51 "description": "Unique identifier for the source"
52 },
53 "address": {
54 "type": "string",
55 "description": "Address of the source"
56 },
57 "channel": {
58 "type": "string",
59 "description": "Channel used to send the message. This can be 'sms', 'whatsapp', 'rcs'"
60 }
61 }
62 },
63 "content": {
64 "type": "object",
65 "description": "Object containing the content of the message",
66 "additionalProperties": false,
67 "properties": {
68 "text": {
69 "type": "string",
70 "description": "Text content of the message"
71 }
72 }
73 },
74 "tags": {
75 "type": "object",
76 "additionalProperties": {
77 "type": "string"
78 },
79 "description": "Object containing key-value pairs for tags"
80 },
81 "channel_metadata": {
82 "type": "object",
83 "description": "Object containing channel specific metadata",
84 "additionalProperties": {
85 "type": "string"
86 }
87 }
88 },
89 "additionalProperties": false
90}

Subscribe to the Twilio Communications API events

Use the following cURL command to create a subscription to the Twilio Communications API events:

$curl -X POST "https://events.twilio.com/v1/Subscriptions" \
>--data-urlencode "Types={\"type\":\"com.twilio.comms-api.operation.completed\"}" \
>--data-urlencode "Types={\"type\":\"com.twilio.comms-api.operation.processing\"}" \
>--data-urlencode "Types={\"type\":\"com.twilio.comms-api.operation.scheduled\"}" \
>--data-urlencode "Types={\"type\":\"com.twilio.comms-api.message.read\"}" \
>--data-urlencode "Types={\"type\":\"com.twilio.comms-api.message.sent\"}" \
>--data-urlencode "Types={\"type\":\"com.twilio.comms-api.message.delivered\"}" \
>--data-urlencode "Types={\"type\":\"com.twilio.comms-api.message.failed\"}" \
>--data-urlencode "Types={\"type\":\"com.twilio.comms-api.message.undelivered\"}" \
>--data-urlencode "Types={\"type\":\"com.twilio.comms-api.message.queued\"}" \
>--data-urlencode "Types={\"type\":\"com.twilio.comms-api.message.inbound-received\"}" \
>--data-urlencode "Description=\"Twilio Communications API subscriptions events\"" \
>--data-urlencode "SinkSid={{Twilio_EventStreams_Sink_SID}}" \
>-u {{Twilio_Account_SID}}:{{Twilio_Auth_Token}} | jq