Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now

メニュー

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?

サービスリソース

A Service is the top-level scope of all other resources in the Programmable Chat REST API. All other Programmable Chat resources, such as Channels, Users, Messages, and Credentials belong to a specific Service.

Services allow you to:

  • Create multiple, distinct environments (such as dev, stage, and prod) under a single Twilio account
  • REST API とクライアント API の両方を通じてリソースへのアクセスのスコープを設定する
  • Configure different service instances with specific behaviors

A Service can also send HTTPS requests to URLs that you define to let you know of specific events. See what events you can subscribe to in our webhook reference.

Twilio コンソール

You can also manage your Programmable Chat Services from your Twilio console when you are logged in.

Service properties

The Service resource contains these properties.

Names in REST API format
sid
sid<IS> Not PII

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

account_sid
sid<AC> Not PII

The SID of the Account that created the Service resource.

friendly_name
文字列 PII MTL: 120 DAYS

The string that you assigned to describe the resource.

date_created
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in ISO 8601 format.

date_updated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in ISO 8601 format.

default_service_role_sid
sid<RL> Not PII

The service role assigned to users when they are added to the service. See the Role resource for more info about roles.

default_channel_role_sid
sid<RL> Not PII

The channel role assigned to users when they are added to a channel. See the Role resource for more info about roles.

default_channel_creator_role_sid
sid<RL> Not PII

The channel role assigned to a channel creator when they join a new channel. See the Role resource for more info about roles.

read_status_enabled
boolean Not PII

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

reachability_enabled
boolean Not PII

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

typing_indicator_timeout
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.

consumption_report_interval
integer Not PII

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

limits
オブジェクト 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.

pre_webhook_url
文字列 Not PII

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

post_webhook_url
文字列 Not PII

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

webhook_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.

webhook_filters
string[] Not PII

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

pre_webhook_retry_count
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.

post_webhook_retry_count
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
オブジェクト Not PII

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

media
オブジェクト Not PII

An object that describes the properties of media that the service supports. The object contains the size_limit_mb property, which describes the size of the largest media file in MB; and the compatibility_message property, which contains the message text to send when a media message does not have any text.

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, Bindings, and Users.

Create a Service resource

post
https://chat.twilio.com/v2/Services
パラメーター
Names in None format
friendly_name
必須
post 文字列 PII MTL: 120 DAYS

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

例 1
        
        
        
        

        Fetch a Service resource

        GET
        https://chat.twilio.com/v2/Services/{Sid}
        パラメーター
        Names in None format
        sid
        必須
        GET sid<IS> Not PII

        The SID of the Service resource to fetch.

        例 1
              
              
              
              

              Read multiple Service resources

              GET
              https://chat.twilio.com/v2/Services
              例 1
                    
                    
                    
                    

                    Update a Service resource

                    post
                    https://chat.twilio.com/v2/Services/{Sid}
                    パラメーター
                    Names in None format
                    sid
                    必須
                    post sid<IS> Not PII

                    The SID of the Service resource to update.

                    friendly_name
                    オプション
                    post 文字列 PII MTL: 120 DAYS

                    A descriptive string that you create to describe the resource.

                    default_service_role_sid
                    オプション
                    post sid<RL> Not PII

                    The service role assigned to users when they are added to the service. See the Role resource for more info about roles.

                    default_channel_role_sid
                    オプション
                    post sid<RL> Not PII

                    The channel role assigned to users when they are added to a channel. See the Role resource for more info about roles.

                    default_channel_creator_role_sid
                    オプション
                    post sid<RL> Not PII

                    The channel role assigned to a channel creator when they join a new channel. See the Role resource for more info about roles.

                    read_status_enabled
                    オプション
                    post boolean Not PII

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

                    reachability_enabled
                    オプション
                    post boolean Not PII

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

                    typing_indicator_timeout
                    オプション
                    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.

                    consumption_report_interval
                    オプション
                    post integer Not PII

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

                    notifications.new_message.enabled
                    オプション
                    post boolean Not PII

                    Whether to send a notification when a new message is added to a channel. The default is false.

                    notifications.new_message.template
                    オプション
                    post 文字列 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.

                    notifications.new_message.sound
                    オプション
                    post 文字列 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.

                    notifications.new_message.badge_count_enabled
                    オプション
                    post boolean Not PII

                    Whether the new message badge is enabled. The default is false.

                    notifications.added_to_channel.enabled
                    オプション
                    post boolean Not PII

                    Whether to send a notification when a member is added to a channel. The default is false.

                    notifications.added_to_channel.template
                    オプション
                    post 文字列 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.

                    notifications.added_to_channel.sound
                    オプション
                    post 文字列 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.

                    notifications.removed_from_channel.enabled
                    オプション
                    post boolean Not PII

                    Whether to send a notification to a user when they are removed from a channel. The default is false.

                    notifications.removed_from_channel.template
                    オプション
                    post 文字列 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.

                    notifications.removed_from_channel.sound
                    オプション
                    post 文字列 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.

                    notifications.invited_to_channel.enabled
                    オプション
                    post boolean Not PII

                    Whether to send a notification when a user is invited to a channel. The default is false.

                    notifications.invited_to_channel.template
                    オプション
                    post 文字列 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.

                    notifications.invited_to_channel.sound
                    オプション
                    post 文字列 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.

                    pre_webhook_url
                    オプション
                    post url Not PII

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

                    post_webhook_url
                    オプション
                    post url Not PII

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

                    webhook_method
                    オプション
                    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.

                    webhook_filters
                    オプション
                    post string[] Not PII

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

                    limits.channel_members
                    オプション
                    post integer Not PII

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

                    limits.user_channels
                    オプション
                    post integer Not PII

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

                    media.compatibility_message
                    オプション
                    post 文字列 Not PII

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

                    pre_webhook_retry_count
                    オプション
                    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.

                    post_webhook_retry_count
                    オプション
                    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.

                    notifications.log_enabled
                    オプション
                    post boolean Not PII

                    Whether to log notifications. The default is false.

                    例 1
                          
                          
                          
                          

                          Delete a Service resource

                          削除する
                          https://chat.twilio.com/v2/Services/{Sid}
                          パラメーター
                          Names in None format
                          sid
                          必須
                          削除する sid<IS> Not PII

                          The SID of the Service resource to delete.

                          例 1
                                
                                
                                
                                
                                Rate this page:

                                ヘルプが必要ですか?

                                誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。