Skip to contentSkip to navigationSkip to topbar
On this page

Notify Service Resource


A Service is the top-level scope of all other resources in Notify REST API.

You can create up to 10 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 10 Service resources for your account, please contact support(link takes you to an external page).


Service Properties

service-properties page anchor
Property nameTypeRequiredDescriptionChild properties
sidSID<IS>Optional
Not PII

The unique string that we created to identify the Service resource.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>Optional

The SID of the Account that created the Service resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

friendly_namestringOptional

The string that you assigned to describe the resource.


date_createdstring<date-time>Optional

The date and time in GMT when the resource was created specified in RFC 2822(link takes you to an external page) format.


date_updatedstring<date-time>Optional

The date and time in GMT when the resource was last updated specified in RFC 2822(link takes you to an external page) format.


apn_credential_sidSID<CR>Optional

The SID of the Credential to use for APN Bindings.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

gcm_credential_sidSID<CR>Optional

The SID of the Credential to use for GCM Bindings.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

fcm_credential_sidSID<CR>Optional

The SID of the Credential to use for FCM Bindings.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

messaging_service_sidSID<MG>Optional

The SID of the Messaging Service to use for SMS Bindings. In order to send SMS notifications this parameter has to be set.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34

facebook_messenger_page_idstringOptional

Deprecated.


default_apn_notification_protocol_versionstringOptional

The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


default_gcm_notification_protocol_versionstringOptional

The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


default_fcm_notification_protocol_versionstringOptional

The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


log_enabledbooleanOptional

Whether to log notifications. Can be: true or false and the default is true.


urlstring<uri>Optional

The absolute URL of the Service resource.


linksobject<uri-map>Optional

The URLs of the Binding, Notification, Segment, and User resources related to the service.


alexa_skill_idstringOptional

Deprecated.


default_alexa_notification_protocol_versionstringOptional

Deprecated.


delivery_callback_urlstringOptional

URL to send delivery status callback.


delivery_callback_enabledbooleanOptional

Callback configuration that enables delivery callbacks, default false


Create a Service resource

create-a-service-resource page anchor
POST https://notify.twilio.com/v1/Services

Request body parameters

request-body-parameters page anchor
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
FriendlyNamestringOptional

A descriptive string that you create to describe the resource. It can be up to 64 characters long.


ApnCredentialSidSID<CR>Optional

The SID of the Credential to use for APN Bindings.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

GcmCredentialSidSID<CR>Optional

The SID of the Credential to use for GCM Bindings.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

MessagingServiceSidSID<MG>Optional

The SID of the Messaging Service to use for SMS Bindings. This parameter must be set in order to send SMS notifications.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34

FacebookMessengerPageIdstringOptional

Deprecated.


DefaultApnNotificationProtocolVersionstringOptional

The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


DefaultGcmNotificationProtocolVersionstringOptional

The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


FcmCredentialSidSID<CR>Optional

The SID of the Credential to use for FCM Bindings.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

DefaultFcmNotificationProtocolVersionstringOptional

The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


LogEnabledbooleanOptional

Whether to log notifications. Can be: true or false and the default is true.


AlexaSkillIdstringOptional

Deprecated.


DefaultAlexaNotificationProtocolVersionstringOptional

Deprecated.


DeliveryCallbackUrlstringOptional

URL to send delivery status callback.


DeliveryCallbackEnabledbooleanOptional

Callback configuration that enables delivery callbacks, default false

Create a Service resourceLink to code sample: Create a Service resource
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createService() {
11
const service = await client.notify.v1.services.create();
12
13
console.log(service.sid);
14
}
15
16
createService();

Output

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
"type": "S",
19
"delivery_callback_url": "Hello",
20
"delivery_callback_enabled": true,
21
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
22
"links": {
23
"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
24
"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",
25
"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",
26
"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
27
}
28
}

Fetch a Service resource

fetch-a-service-resource page anchor
GET https://notify.twilio.com/v1/Services/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<IS>required

The Twilio-provided string that uniquely identifies the Service resource to fetch.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchService() {
11
const service = await client.notify.v1
12
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.fetch();
14
15
console.log(service.sid);
16
}
17
18
fetchService();

Output

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
"type": "S",
19
"delivery_callback_url": "Hello",
20
"delivery_callback_enabled": true,
21
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
22
"links": {
23
"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
24
"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",
25
"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",
26
"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
27
}
28
}

Read multiple Service resources

read-multiple-service-resources page anchor
GET https://notify.twilio.com/v1/Services

Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

The string that identifies the Service resources to read.


PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listService() {
11
const services = await client.notify.v1.services.list({ limit: 20 });
12
13
services.forEach((s) => console.log(s.sid));
14
}
15
16
listService();

Output

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
"type": "S",
30
"delivery_callback_url": "Hello",
31
"delivery_callback_enabled": true,
32
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
33
"links": {
34
"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
35
"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",
36
"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",
37
"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
38
}
39
}
40
]
41
}

Update a Service resource

update-a-service-resource page anchor
POST https://notify.twilio.com/v1/Services/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<IS>required

The Twilio-provided string that uniquely identifies the Service resource to update.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
FriendlyNamestringOptional

A descriptive string that you create to describe the resource. It can be up to 64 characters long.


ApnCredentialSidSID<CR>Optional

The SID of the Credential to use for APN Bindings.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

GcmCredentialSidSID<CR>Optional

The SID of the Credential to use for GCM Bindings.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

MessagingServiceSidSID<MG>Optional

The SID of the Messaging Service to use for SMS Bindings. This parameter must be set in order to send SMS notifications.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34

FacebookMessengerPageIdstringOptional

Deprecated.


DefaultApnNotificationProtocolVersionstringOptional

The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


DefaultGcmNotificationProtocolVersionstringOptional

The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


FcmCredentialSidSID<CR>Optional

The SID of the Credential to use for FCM Bindings.

Pattern: ^CR[0-9a-fA-F]{32}$Min length: 34Max length: 34

DefaultFcmNotificationProtocolVersionstringOptional

The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


LogEnabledbooleanOptional

Whether to log notifications. Can be: true or false and the default is true.


AlexaSkillIdstringOptional

Deprecated.


DefaultAlexaNotificationProtocolVersionstringOptional

Deprecated.


DeliveryCallbackUrlstringOptional

URL to send delivery status callback.


DeliveryCallbackEnabledbooleanOptional

Callback configuration that enables delivery callbacks, default false

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function updateService() {
11
const service = await client.notify.v1
12
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.update({ friendlyName: "FriendlyName" });
14
15
console.log(service.sid);
16
}
17
18
updateService();

Output

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
"type": "S",
19
"delivery_callback_url": "Hello",
20
"delivery_callback_enabled": true,
21
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
22
"links": {
23
"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
24
"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",
25
"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",
26
"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
27
}
28
}

Delete a Service resource

delete-a-service-resource page anchor
DELETE https://notify.twilio.com/v1/Services/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<IS>required

The Twilio-provided string that uniquely identifies the Service resource to delete.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function deleteService() {
11
await client.notify.v1
12
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.remove();
14
}
15
16
deleteService();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.