メニュー

Expand
ページを評価:

Sink Resource

Sinks are the destinations to which events selected in a subscription will be delivered. Each sink has a sink_type property. At this time, the Sink resource supports two types: AWS Kinesis indicated by the value kinesis, and Webhooks indicated by the value webhook. Each Sink has a sink_configuration property which expresses its set up.

Not seeing a sink type you would like to configure? Submit a sink type request.

An example of the sink_configuration object for a Kinesis Sink:

"sink_configuration": { 
  "arn": "arn:aws:kinesis:us-east-1:111111111:stream/test", 
  "role_arn": "arn:aws:iam::111111111:role/Role", 
  "external_id": "a secret value here"
}
パラメーター 概要
arn The Amazon Resource Identifier for the Kinesis stream.
role_arn The Amazon Resource Identifier for the AWS role that has write access to the Kineses stream specified arn.
external_id An ID added to the role specified in role_arn which AWS requires in order to grant a third party access to a given resource. It helps prevent what is known as the Confused Deputy Problem.

Here is an example of the sink_configuration object for a Webhook Sink:

"sink_configuration": { 
    "destination": "http://example.org/webhook",
    "method": "<POST|GET>",
    "batch_events": <true|false>
}
パラメーター 概要
destination The customers' url endpoint i.e http://example.org/webhook
method The HTTP method for updating the data on the webhook. The currently available options are GET and POST.
batch_events false if you want to receive single events and true if you want events sent in batches. Batched events currently have a 64kB data limit.

Each Sink also has a status property. The value of this property will be one of initialized, validating, and active. To receive events, a Sink must be in active status.

Status 概要
initialized The Sink has been created in the Event Streams API, but the connection still needs to be validated.
validating A test event has been published to the Sink. The validation process has started, but has not yet been completed by the customer.
active The sink has been validated or validation is not required. Events can only be delivered to Sinks with active status.

When a new Kinesis Sink is created, its default status is initialized. To make it active, you need to complete the following steps.

  1. First create a Sink resource of type Kinesis. The status of the Kinesis Sink will be initialized by default.
  2. Create a Sink Test Resource using your new Sink. The URL for this POST request is provided in the new Sink’s links object. This will publish a test event to your Sink.
  3. Check your Sink to see if the test event was successfully published. If so, this confirms that you’ve set up your Sink correctly.
  4. If the test was successful, retrieve the test_id and create a Sink Validate resource. The URL for this POST request is provided in the Sink’s links object. This will let Twilio know that you successfully configured the Sink, and will toggle the Sink’s status to active.

Webhook Sinks are active by default, so you do not have to validate them. However, if you choose to validate them, you can still do so with the Test and Validate resources mentioned above.

Sink properties

Resource Properties in REST API format
date_created
date_time<iso8601> Not PII

The date that this Sink was created, given in ISO 8601 format.

date_updated
date_time<iso8601> Not PII

The date that this Sink was updated, given in ISO 8601 format.

description
文字列 Not PII

A human readable description for the Sink

sid
sid<DG> Not PII

A 34 character string that uniquely identifies this Sink.

sink_configuration
オブジェクト Not PII

The information required for Twilio to connect to the provided Sink encoded as JSON.

sink_type
enum:sink_type Not PII

The Sink type. Can only be "kinesis" or "webhook" currently.

status
enum:status Not PII

The Status of this Sink. One of initialized, validating, active or failed.

url
url Not PII

The URL of this resource.

links
uri_map Not PII

Contains a dictionary of URL links to nested resources of this Sink.

Create a Sink resource

post
https://events.twilio.com/v1/Sinks
パラメーター
Parameters in REST API format
description
必須
post 文字列 Not PII

A human readable description for the Sink This value should not contain PII.

sink_configuration
必須
post オブジェクト Not PII

The information required for Twilio to connect to the provided Sink encoded as JSON.

sink_type
必須
post ienum:sink_type Not PII

The Sink type. Can only be "kinesis" or "webhook" currently.

例 1
        
        
        

        Fetch a Sink resource

        GET
        https://events.twilio.com/v1/Sinks/{Sid}

        Fetches a Sink configuration by its SID.

        パラメーター
        Parameters in REST API format
        sid
        Path
        GET sid<DG> Not PII

        A 34 character string that uniquely identifies this Sink.

        例 1
              
              
              

              Read multiple Sink resources

              GET
              https://events.twilio.com/v1/Sinks

              Gets a list of all Sinks belonging to the account associated with the request. Supports pagination.

              パラメーター
              Parameters in REST API format
              in_use
              オプション
              GET boolean Not PII

              A boolean query parameter filtering the results to return sinks used/not used by a subscription.

              status
              オプション
              GET 文字列 Not PII

              A String query parameter filtering the results by status initialized, validating, active or failed.

              例 1
                    
                    
                    

                    Update Sink

                    post
                    https://events.twilio.com/v1/Sinks/{Sid}

                    Updates the description of a Sink

                    パラメーター
                    Parameters in REST API format
                    sid
                    Path
                    post sid<DG> Not PII

                    A 34 character string that uniquely identifies this Sink.

                    description
                    必須
                    post 文字列 Not PII

                    A human readable description for the Sink This value should not contain PII.

                    例 1
                          
                          
                          

                          Delete a Sink resource

                          削除する
                          https://events.twilio.com/v1/Sinks/{Sid}

                          Deletes the Sink with the specified SID. If the Sink has a Subscription associated with it, the Subscription must be deleted first in order to delete the Sink.

                          パラメーター
                          Parameters in REST API format
                          sid
                          Path
                          削除する sid<DG> Not PII

                          A 34 character string that uniquely identifies this Sink.

                          例 1
                                
                                
                                
                                ページを評価:

                                ヘルプが必要ですか?

                                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 Community Forums or browsing the Twilio tag on Stack Overflow.

                                      
                                      
                                      

                                      フィードバックくださりありがとうございます!

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

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

                                      Thanks for your feedback!

                                      Refer us and get $10 in 3 simple steps!

                                      ステップ1

                                      Get link

                                      Get a free personal referral link here

                                      ステップ2:

                                      Give $10

                                      Your user signs up and upgrade using link

                                      ステップ3

                                      Get $10

                                      1,250 free SMSes
                                      OR 1,000 free voice mins
                                      OR 12,000 chats
                                      OR more