Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Services Resource

A Service is the top-level scope of all other resources in the Programmable Chat REST API. It owns Channels, Users, Messages, Credentials, and all other data for a Chat implementation. Services allow the developer to:

  • Create multiple environments (dev, stage, prod) under the same Twilio account with segregated data
  • Scope access to resources through both the REST and client APIs
  • Configure various behaviors of the service per instance

A Service will also send HTTPS requests to URLs configured by the developer when interesting events happen. Check out the webhook reference to see what events you can subscribe to in your Service.

Twilio Console

You can manage your Programmable Chat Services using your Twilio console when logged in to the console.

Properties

Each service has these properties:

Names in PHP format
sid
sid<IS> Not PII

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

accountSid
sid<AC> Not PII

The SID of the Account that created the Service resource.

friendlyName

The string that you assigned to describe the resource.

dateCreated
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in RFC 2822 format.

dateUpdated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in RFC 2822 format.

defaultServiceRoleSid
sid<RL> Not PII

The service role assigned to users when they are added to the service. See the Roles endpoint for more details.

defaultChannelRoleSid
sid<RL> Not PII

The channel role assigned to users when they are added to a channel. See the Roles endpoint for more details.

defaultChannelCreatorRoleSid
sid<RL> Not PII

The channel role assigned to a channel creator when they join a new channel. See the Roles endpoint for more details.

readStatusEnabled
boolean Not PII

Whether the Message Consumption Horizon feature is enabled. The default is true.

reachabilityEnabled
boolean Not PII

Whether the Reachability Indicator is enabled for this Service instance. The default is false.

typingIndicatorTimeout
integer Not PII

How long in seconds after a started typing event until clients should assume that user is no longer typing, even if no ended typing message was received. The default is 5 seconds.

consumptionReportInterval
integer Not PII

DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints.

limits
object Not PII

An object that describes the limits of the service instance. The limits object contains channel_members to describe the members/channel limit and user_channels to describe the channels/user limit. channel_members can be 1,000 or less, with a default of 250. user_channels can be 1,000 or less, with a default value of 100.

preWebhookUrl
string Not PII

The URL for pre-event webhooks, which are called by using the webhook_method. See Webhook Events for more details.

postWebhookUrl
string Not PII

The URL for post-event webhooks, which are called by using the webhook_method. See Webhook Events for more details.

webhookMethod
string Not PII

The HTTP method to use for calls to the pre_webhook_url and post_webhook_url webhooks. Can be: POST or GET and the default is POST. See Webhook Events for more details.

webhookFilters
string[] Not PII

The list of WebHook events that are enabled for this Service instance. See Webhook Events for more details.

preWebhookRetryCount
integer Not PII

The number of times to retry a call to the pre_webhook_url if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried.

postWebhookRetryCount
integer Not PII

The number of times to retry a call to the post_webhook_url if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried.

notifications
object Not PII

The notification configuration for the Service instance. See Push Notification Configuration for more information.

media
object Not PII

An object that describes the properties of the media that the service supports.

url
url Not PII

The absolute URL of the Service resource.

links
uri_map Not PII

The absolute URLs of the Service's Channels, Roles, and Users.

List All Services

GET /Services
        
        
        
        

        Create A Service

        POST /Services
        

        Parameters

        Names in PHP format
        friendlyName
        Required
        post string PII MTL: 120 DAYS

        A descriptive string that you create to describe the new resource.

              
              
              
              

              Retrieve a Service

              GET /Services/{Service SID}
              
                    
                    
                    
                    

                    Update A Service

                    POST /Services/{Service SID}
                    

                    Parameters

                    Names in PHP format
                    sid
                    Required
                    post sid<IS> Not PII

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

                    friendlyName
                    Optional
                    post string PII MTL: 120 DAYS

                    A descriptive string that you create to describe the resource.

                    defaultServiceRoleSid
                    Optional
                    post sid<RL> Not PII

                    The service role assigned to users when they are added to the service. See the Roles endpoint for more details.

                    defaultChannelRoleSid
                    Optional
                    post sid<RL> Not PII

                    The channel role assigned to users when they are added to a channel. See the Roles endpoint for more details.

                    defaultChannelCreatorRoleSid
                    Optional
                    post sid<RL> Not PII

                    The channel role assigned to a channel creator when they join a new channel. See the Roles endpoint for more details.

                    readStatusEnabled
                    Optional
                    post boolean Not PII

                    Whether to enable the Message Consumption Horizon feature. The default is true.

                    reachabilityEnabled
                    Optional
                    post boolean Not PII

                    Whether to enable the Reachability Indicator for this Service instance. The default is false.

                    typingIndicatorTimeout
                    Optional
                    post integer Not PII

                    How long in seconds after a started typing event until clients should assume that user is no longer typing, even if no ended typing message was received. The default is 5 seconds.

                    consumptionReportInterval
                    Optional
                    post integer Not PII

                    DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints.

                    notificationsNewMessageEnabled
                    Optional
                    post boolean Not PII

                    Whether to send a notification when a new message is added to a channel. Can be: true or false and the default is false.

                    notificationsNewMessageTemplate
                    Optional
                    post string Not PII

                    The template to use to create the notification text displayed when a new message is added to a channel and notifications.new_message.enabled is true.

                    notificationsNewMessageSound
                    Optional
                    post string Not PII

                    The name of the sound to play when a new message is added to a channel and notifications.new_message.enabled is true.

                    notificationsNewMessageBadgeCountEnabled
                    Optional
                    post boolean Not PII

                    Whether the new message badge is enabled. Can be: true or false and the default is false.

                    notificationsAddedToChannelEnabled
                    Optional
                    post boolean Not PII

                    Whether to send a notification when a member is added to a channel. Can be: true or false and the default is false.

                    notificationsAddedToChannelTemplate
                    Optional
                    post string Not PII

                    The template to use to create the notification text displayed when a member is added to a channel and notifications.added_to_channel.enabled is true.

                    notificationsAddedToChannelSound
                    Optional
                    post string Not PII

                    The name of the sound to play when a member is added to a channel and notifications.added_to_channel.enabled is true.

                    notificationsRemovedFromChannelEnabled
                    Optional
                    post boolean Not PII

                    Whether to send a notification to a user when they are removed from a channel. Can be: true or false and the default is false.

                    notificationsRemovedFromChannelTemplate
                    Optional
                    post string Not PII

                    The template to use to create the notification text displayed to a user when they are removed from a channel and notifications.removed_from_channel.enabled is true.

                    notificationsRemovedFromChannelSound
                    Optional
                    post string Not PII

                    The name of the sound to play to a user when they are removed from a channel and notifications.removed_from_channel.enabled is true.

                    notificationsInvitedToChannelEnabled
                    Optional
                    post boolean Not PII

                    Whether to send a notification when a user is invited to a channel. Can be: true or false and the default is false.

                    notificationsInvitedToChannelTemplate
                    Optional
                    post string Not PII

                    The template to use to create the notification text displayed when a user is invited to a channel and notifications.invited_to_channel.enabled is true.

                    notificationsInvitedToChannelSound
                    Optional
                    post string Not PII

                    The name of the sound to play when a user is invited to a channel and notifications.invited_to_channel.enabled is true.

                    preWebhookUrl
                    Optional
                    post url Not PII

                    The URL for pre-event webhooks, which are called by using the webhook_method. See Webhook Events for more details.

                    postWebhookUrl
                    Optional
                    post url Not PII

                    The URL for post-event webhooks, which are called by using the webhook_method. See Webhook Events for more details.

                    webhookMethod
                    Optional
                    post http_method Not PII

                    The HTTP method to use for calls to the pre_webhook_url and post_webhook_url webhooks. Can be: POST or GET and the default is POST. See Webhook Events for more details.

                    webhookFilters
                    Optional
                    post string[] Not PII

                    The list of WebHook events that are enabled for this Service instance. See Webhook Events for more details.

                    limitsChannelMembers
                    Optional
                    post integer Not PII

                    The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000.

                    limitsUserChannels
                    Optional
                    post integer Not PII

                    The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000.

                    mediaCompatibilityMessage
                    Optional
                    post string Not PII

                    The message to send when a media message has no text. Can be used as placeholder message.

                    preWebhookRetryCount
                    Optional
                    post integer Not PII

                    The number of times to retry a call to the pre_webhook_url if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried.

                    postWebhookRetryCount
                    Optional
                    post integer Not PII

                    The number of times to retry a call to the post_webhook_url if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried.

                    notificationsLogEnabled
                    Optional
                    post boolean Not PII

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

                          
                          
                          
                          

                          Delete A Service

                          DELETE /Services/{Service SID}
                          
                                
                                
                                
                                
                                Rate this page:

                                Need some help?

                                We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.