Notify Service Resource
A Service is the top-level scope of all other resources in Notify REST API.
You can create up to 1000 Service resources per account and you can use them to:
- Create separate operational environments, such as dev, stage, and prod, all using the same Twilio account.
- Scope access to resources used by the Notify REST API
- Configure different behaviors of a push-notification or messaging service.
If you need more than 1000 Service resources for your account, please contact support.
The unique string that we created to identify the Service resource.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Account that created the Service resource.
^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34The date and time in GMT when the resource was created specified in RFC 2822 format.
The date and time in GMT when the resource was last updated specified in RFC 2822 format.
The SID of the Credential to use for APN Bindings.
^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Credential to use for GCM Bindings.
^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Credential to use for FCM Bindings.
^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Messaging Service to use for SMS Bindings. In order to send SMS notifications this parameter has to be set.
^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.
The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.
The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.
Whether to log notifications. Can be: true or false and the default is true.
The URLs of the Binding, Notification, Segment, and User resources related to the service.
Callback configuration that enables delivery callbacks, default false
POST https://notify.twilio.com/v1/Services
application/x-www-form-urlencodedA descriptive string that you create to describe the resource. It can be up to 64 characters long.
The SID of the Credential to use for APN Bindings.
^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Credential to use for GCM Bindings.
^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Messaging Service to use for SMS Bindings. This parameter must be set in order to send SMS notifications.
^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.
The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.
The SID of the Credential to use for FCM Bindings.
^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.
Whether to log notifications. Can be: true or false and the default is true.
Callback configuration that enables delivery callbacks, default false
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createService() {11const service = await client.notify.v1.services.create();1213console.log(service.sid);14}1516createService();
Response
1{2"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c",5"date_created": "2016-03-09T20:22:31Z",6"date_updated": "2016-03-09T20:22:31Z",7"apn_credential_sid": null,8"gcm_credential_sid": null,9"fcm_credential_sid": null,10"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",11"facebook_messenger_page_id": "4",12"alexa_skill_id": null,13"default_apn_notification_protocol_version": "3",14"default_gcm_notification_protocol_version": "3",15"default_fcm_notification_protocol_version": "3",16"default_alexa_notification_protocol_version": "3",17"log_enabled": true,18"delivery_callback_url": "Hello",19"delivery_callback_enabled": true,20"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",21"links": {22"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",23"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",24"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",25"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"26}27}
GET https://notify.twilio.com/v1/Services/{Sid}
The Twilio-provided string that uniquely identifies the Service resource to fetch.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 341// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchService() {11const service = await client.notify.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.fetch();1415console.log(service.sid);16}1718fetchService();
Response
1{2"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c",5"date_created": "2016-03-09T20:22:31Z",6"date_updated": "2016-03-09T20:22:31Z",7"apn_credential_sid": null,8"gcm_credential_sid": null,9"fcm_credential_sid": null,10"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",11"facebook_messenger_page_id": "4",12"alexa_skill_id": null,13"default_apn_notification_protocol_version": "3",14"default_gcm_notification_protocol_version": "3",15"default_fcm_notification_protocol_version": "3",16"default_alexa_notification_protocol_version": "3",17"log_enabled": true,18"delivery_callback_url": "Hello",19"delivery_callback_enabled": true,20"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",21"links": {22"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",23"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",24"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",25"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"26}27}
GET https://notify.twilio.com/v1/Services
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1Maximum: 1000The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listService() {11const services = await client.notify.v1.services.list({ limit: 20 });1213services.forEach((s) => console.log(s.sid));14}1516listService();
Response
1{2"meta": {3"page": 0,4"page_size": 50,5"first_page_url": "https://notify.twilio.com/v1/Services?PageSize=50&Page=0",6"previous_page_url": null,7"url": "https://notify.twilio.com/v1/Services?PageSize=50&Page=0",8"next_page_url": null,9"key": "services"10},11"services": [12{13"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c",16"date_created": "2016-03-09T20:22:31Z",17"date_updated": "2016-03-09T20:22:31Z",18"apn_credential_sid": null,19"gcm_credential_sid": null,20"fcm_credential_sid": null,21"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",22"facebook_messenger_page_id": "4",23"alexa_skill_id": null,24"default_apn_notification_protocol_version": "3",25"default_gcm_notification_protocol_version": "3",26"default_fcm_notification_protocol_version": "3",27"default_alexa_notification_protocol_version": "3",28"log_enabled": true,29"delivery_callback_url": "Hello",30"delivery_callback_enabled": true,31"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",32"links": {33"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",34"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",35"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",36"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"37}38}39]40}
POST https://notify.twilio.com/v1/Services/{Sid}
The Twilio-provided string that uniquely identifies the Service resource to update.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34application/x-www-form-urlencodedA descriptive string that you create to describe the resource. It can be up to 64 characters long.
The SID of the Credential to use for APN Bindings.
^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Credential to use for GCM Bindings.
^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Messaging Service to use for SMS Bindings. This parameter must be set in order to send SMS notifications.
^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.
The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.
The SID of the Credential to use for FCM Bindings.
^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.
Whether to log notifications. Can be: true or false and the default is true.
Callback configuration that enables delivery callbacks, default false
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateService() {11const service = await client.notify.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.update({ friendlyName: "FriendlyName" });1415console.log(service.sid);16}1718updateService();
Response
1{2"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"friendly_name": "FriendlyName",5"date_created": "2016-03-09T20:22:31Z",6"date_updated": "2016-03-09T20:22:31Z",7"apn_credential_sid": null,8"gcm_credential_sid": null,9"fcm_credential_sid": null,10"default_apn_notification_protocol_version": "3",11"default_gcm_notification_protocol_version": "3",12"default_fcm_notification_protocol_version": "3",13"default_alexa_notification_protocol_version": "3",14"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"alexa_skill_id": null,16"facebook_messenger_page_id": "4",17"log_enabled": true,18"delivery_callback_url": "Hello",19"delivery_callback_enabled": true,20"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",21"links": {22"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",23"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",24"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",25"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"26}27}
DELETE https://notify.twilio.com/v1/Services/{Sid}
The Twilio-provided string that uniquely identifies the Service resource to delete.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 341// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteService() {11await client.notify.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.remove();14}1516deleteService();