Subscribed Event Resource
With this API the user can perform CRUD operations on an Event associated with a Subscription.
With the Subscribed Event API you can:
Add an existing event type to a subscription
Get all events associated with a subscription
Update an event on a subscription
Delete an event on a subscription
Resource properties The unique SID identifier of the Account.
Type of event being subscribed to.
The schema version that the Subscription should use.
subscription_sid
type: SID<DF> Not PIIThe unique SID identifier of the Subscription.
The URL of this resource.
POST https://events.twilio.com/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents
This endpoint adds an existing event type to a particular subscription. It is possible to specify the version of the schema to use for the given event type. Otherwise the last available schema version will be used for the added event type.
URI parameters SubscriptionSid
type: SID<DF> Not PIIPath Parameter
The unique SID identifier of the Subscription.
Request body parameters Required
Type of event being subscribed to.
The schema version that the Subscription should use.
Adds an event type to the subscription to the latest schema version available
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .create({type: 'com.twilio.messaging.message.delivered'})
_11 .then(subscribed_event => console.log(subscribed_event.type));
_10 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10 "subscription_sid": "DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10 "type": "com.twilio.messaging.message.delivered",
_10 "url": "https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents/com.twilio.messaging.message.delivered"
Add an event type specifying the schema version to be used
_14 // Download the helper library from https://www.twilio.com/docs/node/install
_14 // Find your Account SID and Auth Token at twilio.com/console
_14 // and set the environment variables. See http://twil.io/secure
_14 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14 const authToken = process.env.TWILIO_AUTH_TOKEN;
_14 const client = require('twilio')(accountSid, authToken);
_14 client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_14 type: 'com.twilio.messaging.message.delivered'
_14 .then(subscribed_event => console.log(subscribed_event.type));
_10 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10 "subscription_sid": "DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10 "type": "com.twilio.messaging.message.delivered",
_10 "url": "https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents/com.twilio.messaging.message.delivered"
GET https://events.twilio.com/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents
Get all event types associated with a particular subscription
URI parameters SubscriptionSid
type: SID<DF> Not PIIPath Parameter
The unique SID identifier of the Subscription.
Query Parameter
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Query Parameter
The page index. This value is simply for client state.
Query Parameter
The page token. This is provided by the API.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(subscribedEvents => subscribedEvents.forEach(s => console.log(s.type)));
_27 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27 "type": "com.twilio.messaging.message.delivered",
_27 "subscription_sid": "DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27 "url": "https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents/com.twilio.messaging.message.delivered"
_27 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27 "type": "com.twilio.messaging.message.failed",
_27 "schema_version": 15,
_27 "subscription_sid": "DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27 "url": "https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents/com.twilio.messaging.message.failed"
_27 "first_page_url": "https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents?PageSize=50&Page=0",
_27 "previous_page_url": "https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents?PageSize=50&Page=0",
_27 "url": "https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents?PageSize=50&Page=0",
_27 "next_page_url": "https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents?PageSize=50&Page=1",
POST https://events.twilio.com/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents/{Type}
Updates the event type
URI parameters SubscriptionSid
type: SID<DF> Not PIIPath Parameter
The unique SID identifier of the Subscription.
Path Parameter
Type of event being subscribed to.
Request body parameters The schema version that the Subscription should use.
Downgrade the version of the subscribed event type
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .subscribedEvents('com.twilio.messaging.message.delivered')
_11 .update({schemaVersion: 1})
_11 .then(subscribed_event => console.log(subscribed_event.type));
_10 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10 "subscription_sid": "DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10 "type": "com.twilio.messaging.message.delivered",
_10 "url": "https://events.twilio.com/v1/Subscriptions/DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SubscribedEvents/com.twilio.messaging.message.delivered"
DELETE https://events.twilio.com/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents/{Type}
Deletes an event type on a subscription.
URI parameters SubscriptionSid
type: SID<DF> Not PIIPath Parameter
The unique SID identifier of the Subscription.
Path Parameter
Type of event being subscribed to.
_10 // Download the helper library from https://www.twilio.com/docs/node/install
_10 // Find your Account SID and Auth Token at twilio.com/console
_10 // and set the environment variables. See http://twil.io/secure
_10 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10 const authToken = process.env.TWILIO_AUTH_TOKEN;
_10 const client = require('twilio')(accountSid, authToken);
_10 client.events.v1.subscriptions('DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10 .subscribedEvents('com.twilio.messaging.message.delivered')