Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

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 three types: AWS Kinesis indicated by the value kinesis, Webhooks indicated by the value webhook, and Segment indicated by the value segment . Each Sink has a sink_configuration property which expresses its set up.

(information)

Info

An example of the sink_configurationobject for a Kinesis Sink:


_10
"sink_configuration": {
_10
"arn": "arn:aws:kinesis:us-east-1:111111111:stream/test",
_10
"role_arn": "arn:aws:iam::111111111:role/Role",
_10
"external_id": "a secret value here"
_10
}

ParameterDescription
arnThe Amazon Resource Identifier(link takes you to an external page) for the Kinesis stream.
role_arnThe Amazon Resource Identifier for the AWS role that has write access to the Kineses stream specified arn.
external_idAn 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(link takes you to an external page).

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


_10
"sink_configuration": {
_10
"destination": "http://example.org/webhook",
_10
"method": "<POST|GET>"
_10
}

ParameterDescription
destinationThe customers' url endpoint i.e http://example.org/webhook(link takes you to an external page)
methodThe HTTP method for updating the data on the webhook. The currently available options are GET and POST.

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


_10
"sink_configuration": {
_10
"write_key": "lwfOUDBL0VK33XstNWD3uJ7Eei2BdgY3"
_10
}

ParameterDescription
write_keySegment write key(link takes you to an external page) for the Segment source that you will use

Sink Properties

sink-properties page anchor
Property nameTypePIIDescription
date_createdstring<date-time>
Not PII

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


date_updatedstring<date-time>

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


descriptionstring

A human readable description for the Sink


sidSID<DG>

A 34 character string that uniquely identifies this Sink.

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

sink_configurationobject

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


sink_typeenum<string>

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

Possible values:
kinesiswebhooksegment

statusenum<string>

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

Possible values:
initializedvalidatingactivefailed

urlstring<uri>

The URL of this resource.


linksobject<uri-map>

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


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

Request body parameters

request-body-parameters page anchor
Property nameTypeRequiredPIIDescription
Descriptionstringrequired

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


SinkConfigurationobjectrequired

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


SinkTypeenum<string>required

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

Possible values:
kinesiswebhooksegment

Create Sink

create-sink page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_24
// Download the helper library from https://www.twilio.com/docs/node/install
_24
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_24
_24
// Find your Account SID and Auth Token at twilio.com/console
_24
// and set the environment variables. See http://twil.io/secure
_24
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_24
const authToken = process.env.TWILIO_AUTH_TOKEN;
_24
const client = twilio(accountSid, authToken);
_24
_24
async function createSink() {
_24
const sink = await client.events.v1.sinks.create({
_24
description: "My Kinesis Sink",
_24
sinkConfiguration: {
_24
arn: "arn:aws:kinesis:us-east-1:111111111:stream/test",
_24
role_arn: "arn:aws:iam::111111111:role/Role",
_24
external_id: "1234567890",
_24
},
_24
sinkType: "kinesis",
_24
});
_24
_24
console.log(sink.dateCreated);
_24
}
_24
_24
createSink();

Output

_18
{
_18
"status": "initialized",
_18
"sink_configuration": {
_18
"arn": "arn:aws:kinesis:us-east-1:111111111:stream/test",
_18
"role_arn": "arn:aws:iam::111111111:role/Role",
_18
"external_id": "1234567890"
_18
},
_18
"description": "My Kinesis Sink",
_18
"sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18
"date_created": "2015-07-30T20:00:00Z",
_18
"sink_type": "kinesis",
_18
"date_updated": "2015-07-30T20:00:00Z",
_18
"url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18
"links": {
_18
"sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test",
_18
"sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate"
_18
}
_18
}


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

Fetches a Sink configuration by its SID.

Property nameTypeRequiredPIIDescription
SidSID<DG>required

A 34 character string that uniquely identifies this Sink.

Pattern: ^DG[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function fetchSink() {
_18
const sink = await client.events.v1
_18
.sinks("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_18
.fetch();
_18
_18
console.log(sink.sinkConfiguration);
_18
}
_18
_18
fetchSink();

Output

_18
{
_18
"status": "initialized",
_18
"sink_configuration": {
_18
"arn": "arn:aws:kinesis:us-east-1:111111111:stream/test",
_18
"role_arn": "arn:aws:iam::111111111:role/Role",
_18
"external_id": "1234567890"
_18
},
_18
"description": "A Sink",
_18
"sid": "DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"date_created": "2015-07-30T20:00:00Z",
_18
"sink_type": "kinesis",
_18
"date_updated": "2015-07-30T20:00:00Z",
_18
"url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18
"links": {
_18
"sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test",
_18
"sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate"
_18
}
_18
}


Read multiple Sink resources

read-multiple-sink-resources page anchor
GET https://events.twilio.com/v1/Sinks

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

Property nameTypeRequiredPIIDescription
InUsebooleanOptional

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


StatusstringOptional

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


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.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function listSink() {
_16
const sinks = await client.events.v1.sinks.list({ limit: 20 });
_16
_16
sinks.forEach((s) => console.log(s.dateCreated));
_16
}
_16
_16
listSink();

Output

_67
{
_67
"sinks": [
_67
{
_67
"status": "initialized",
_67
"sink_configuration": {
_67
"arn": "arn:aws:kinesis:us-east-1:111111111:stream/test",
_67
"role_arn": "arn:aws:iam::111111111:role/Role",
_67
"external_id": "1234567890"
_67
},
_67
"description": "A Sink",
_67
"sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_67
"date_created": "2015-07-30T19:00:00Z",
_67
"sink_type": "kinesis",
_67
"date_updated": "2015-07-30T19:00:00Z",
_67
"url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_67
"links": {
_67
"sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test",
_67
"sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate"
_67
}
_67
},
_67
{
_67
"status": "initialized",
_67
"sink_configuration": {
_67
"arn": "arn:aws:kinesis:us-east-1:222222222:stream/test",
_67
"role_arn": "arn:aws:iam::111111111:role/Role",
_67
"external_id": "1234567890"
_67
},
_67
"description": "ANOTHER Sink",
_67
"sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
_67
"date_created": "2015-07-30T20:00:00Z",
_67
"sink_type": "kinesis",
_67
"date_updated": "2015-07-30T20:00:00Z",
_67
"url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
_67
"links": {
_67
"sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Test",
_67
"sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Validate"
_67
}
_67
},
_67
{
_67
"status": "active",
_67
"sink_configuration": {
_67
"destination": "http://example.org/webhook",
_67
"method": "POST",
_67
"batch_events": true
_67
},
_67
"description": "A webhook Sink",
_67
"sid": "DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac",
_67
"date_created": "2015-07-30T21:00:00Z",
_67
"sink_type": "webhook",
_67
"date_updated": "2015-07-30T21:00:00Z",
_67
"url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac",
_67
"links": {
_67
"sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Test",
_67
"sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Validate"
_67
}
_67
}
_67
],
_67
"meta": {
_67
"page": 0,
_67
"page_size": 20,
_67
"first_page_url": "https://events.twilio.com/v1/Sinks?PageSize=20&Page=0",
_67
"previous_page_url": null,
_67
"url": "https://events.twilio.com/v1/Sinks?PageSize=20&Page=0",
_67
"next_page_url": null,
_67
"key": "sinks"
_67
}
_67
}


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

Updates the description of a Sink

Property nameTypeRequiredPIIDescription
SidSID<DG>required

A 34 character string that uniquely identifies this Sink.

Pattern: ^DG[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
Descriptionstringrequired

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

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function updateSink() {
_18
const sink = await client.events.v1
_18
.sinks("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_18
.update({ description: "My Kinesis Sink" });
_18
_18
console.log(sink.dateCreated);
_18
}
_18
_18
updateSink();

Output

_18
{
_18
"status": "initialized",
_18
"sink_configuration": {
_18
"arn": "arn:aws:kinesis:us-east-1:111111111:stream/test",
_18
"role_arn": "arn:aws:iam::111111111:role/Role",
_18
"external_id": "1234567890"
_18
},
_18
"description": "My Kinesis Sink",
_18
"sid": "DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"date_created": "2015-07-30T20:00:00Z",
_18
"sink_type": "kinesis",
_18
"date_updated": "2015-07-30T20:00:00Z",
_18
"url": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18
"links": {
_18
"sink_test": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test",
_18
"sink_validate": "https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate"
_18
}
_18
}


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

Property nameTypeRequiredPIIDescription
SidSID<DG>required

A 34 character string that uniquely identifies this Sink.

Pattern: ^DG[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_14
// Download the helper library from https://www.twilio.com/docs/node/install
_14
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_14
_14
// Find your Account SID and Auth Token at twilio.com/console
_14
// and set the environment variables. See http://twil.io/secure
_14
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14
const authToken = process.env.TWILIO_AUTH_TOKEN;
_14
const client = twilio(accountSid, authToken);
_14
_14
async function deleteSink() {
_14
await client.events.v1.sinks("DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").remove();
_14
}
_14
_14
deleteSink();


Rate this page: