Menu

Expand
Rate this page:

Channel Webhook Resource

Programmable Chat has been deprecated and is no longer supported. Instead, we'll be focusing on the next generation of chat: Twilio Conversations. Find out more about the EOL process here.

If you're starting a new project, please visit the Conversations Docs to begin. If you've already built on Programmable Chat, please visit our Migration Guide to learn about how to switch.

A Channel Webhook resource describes a webhook target that is specific to a Channel. By default, events in a Programmable Chat instance are delivered to a webhook address that is specified for the whole Chat Service. However, you can use this resource to specify up to five unique webhook targets for each channel to handle exceptional cases.

The webhook target can be a Web URL or a Studio Flow.

ChannelWebhook properties

Resource Properties in REST API format
sid
sid<WH> Not PII

The unique string that we created to identify the Channel Webhook resource.

account_sid
sid<AC> Not PII

The SID of the Account that created the Channel Webhook resource.

service_sid
sid<IS> Not PII

The SID of the Service the Channel Webhook resource is associated with.

channel_sid
sid<CH> Not PII

The SID of the Channel the Channel Webhook resource belongs to.

type
string Not PII

The type of webhook. Can be: webhook, studio, or trigger.

url
url Not PII

The absolute URL of the Channel Webhook resource.

configuration
object Not PII

The JSON string that describes how the channel webhook is configured. The configuration object contains the url, method, filters, and retry_count values that are configured by the create and update actions.

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.

Create a ChannelWebhook resource

post
https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks

The {ChannelSid} value can be the Channel's sid or its unique_name.

Parameters
Parameters in REST API format
service_sid
Path
post sid<IS> Not PII

The SID of the Service with the Channel to create the Webhook resource under.

channel_sid
Path
post sid_like<CH> Not PII

The SID of the Channel the new Channel Webhook resource belongs to. This value can be the Channel resource's sid or unique_name.

type
Required
post enum:type Not PII

The type of webhook. Can be: webhook, studio, or trigger.

configuration.url
Optional
post string Not PII

The URL of the webhook to call using the configuration.method.

configuration.method
Optional
post enum:method Not PII

The HTTP method used to call configuration.url. Can be: GET or POST and the default is POST.

configuration.filters
Optional
post string[] Not PII

The events that cause us to call the Channel Webhook. Used when type is webhook. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see Webhook Event Triggers.

configuration.triggers
Optional
post string[] Not PII

A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when type = trigger.

configuration.flow_sid
Optional
post sid<FW> Not PII

The SID of the Studio Flow to call when an event in configuration.filters occurs. Used only when type is studio.

configuration.retry_count
Optional
post integer Not PII

The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0.

Example 1
Loading Code Sample...
        
        

        Create a Channel Webhook resource

        Fetch a ChannelWebhook resource

        get
        https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}

        The {ChannelSid} value can be the Channel's sid or its unique_name.

        Parameters
        Parameters in REST API format
        service_sid
        Path
        get sid<IS> Not PII

        The SID of the Service with the Channel to fetch the Webhook resource from.

        channel_sid
        Path
        get sid_like<CH> Not PII

        The SID of the Channel the Channel Webhook resource to fetch belongs to. This value can be the Channel resource's sid or unique_name.

        sid
        Path
        get sid<WH> Not PII

        The SID of the Channel Webhook resource to fetch.

        Example 1
        Loading Code Sample...
              
              

              Fetch a Channel Webhook resource

              Read multiple ChannelWebhook resources

              get
              https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks

              The {ChannelSid} value can be the Channel's sid or its unique_name.

              Parameters
              Parameters in REST API format
              service_sid
              Path
              get sid<IS> Not PII

              The SID of the Service with the Channel to read the resources from.

              channel_sid
              Path
              get sid_like<CH> Not PII

              The SID of the Channel the Channel Webhook resources to read belong to. This value can be the Channel resource's sid or unique_name.

              Example 1
              Loading Code Sample...
                    
                    

                    Read multiple Channel Webhook resources

                    Update a ChannelWebhook resource

                    post
                    https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}

                    The {ChannelSid} value can be the Channel's sid or its unique_name.

                    Parameters
                    Parameters in REST API format
                    service_sid
                    Path
                    post sid<IS> Not PII

                    The SID of the Service with the Channel that has the Webhook resource to update.

                    channel_sid
                    Path
                    post sid_like<CH> Not PII

                    The SID of the Channel the Channel Webhook resource to update belongs to. This value can be the Channel resource's sid or unique_name.

                    sid
                    Path
                    post sid<WH> Not PII

                    The SID of the Channel Webhook resource to update.

                    configuration.url
                    Optional
                    post string Not PII

                    The URL of the webhook to call using the configuration.method.

                    configuration.method
                    Optional
                    post enum:method Not PII

                    The HTTP method used to call configuration.url. Can be: GET or POST and the default is POST.

                    configuration.filters
                    Optional
                    post string[] Not PII

                    The events that cause us to call the Channel Webhook. Used when type is webhook. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see Webhook Event Triggers.

                    configuration.triggers
                    Optional
                    post string[] Not PII

                    A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when type = trigger.

                    configuration.flow_sid
                    Optional
                    post sid<FW> Not PII

                    The SID of the Studio Flow to call when an event in configuration.filters occurs. Used only when type = studio.

                    configuration.retry_count
                    Optional
                    post integer Not PII

                    The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0.

                    Example 1
                    Loading Code Sample...
                          
                          

                          Update a Channel Webhook resource

                          Delete a ChannelWebhook resource

                          delete
                          https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}

                          The {ChannelSid} value can be the Channel's sid or its unique_name.

                          Parameters
                          Parameters in REST API format
                          service_sid
                          Path
                          delete sid<IS> Not PII

                          The SID of the Service with the Channel to delete the Webhook resource from.

                          channel_sid
                          Path
                          delete sid_like<CH> Not PII

                          The SID of the Channel the Channel Webhook resource to delete belongs to. This value can be the Channel resource's sid or unique_name.

                          sid
                          Path
                          delete sid<WH> Not PII

                          The SID of the Channel Webhook resource to delete.

                          Example 1
                          Loading Code Sample...
                                
                                

                                Delete a Channel Webhook resource

                                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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                                Loading Code Sample...
                                      
                                      
                                      

                                      Thank you for your feedback!

                                      Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                      Sending your feedback...
                                      🎉 Thank you for your feedback!
                                      Something went wrong. Please try again.

                                      Thanks for your feedback!

                                      thanks-feedback-gif