Integrations / Segment
Segment
Twilio Segment Public API: list and inspect sources, destinations, tracking plans, functions and Engage audiences, and read the workspace. US and EU workspaces are supported through the region field.
8 actions
API key
8 read0 write
Calls api.segmentapis.com
Connect
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "segment" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();Permissions requested
This toolkit uses a single credential and requests no scopes.
Actions
Get destinationreadsegment.get_destinationGet one destination by id, with its settings and enabled state.
| Input | Type | Description | |
|---|---|---|---|
destination_id | string | Required | Destination id |
await setu.execute({
userId: "user_1",
action: "segment.get_destination",
input: {
"destination_id": "<destination_id>"
},
});Get sourcereadsegment.get_sourceGet one source by id, including its tracking plan id if one is attached.
| Input | Type | Description | |
|---|---|---|---|
source_id | string | Required | Source id |
await setu.execute({
userId: "user_1",
action: "segment.get_source",
input: {
"source_id": "<source_id>"
},
});Get workspacereadsegment.get_workspaceGet the workspace the token belongs to: id, name and slug.
No input.
await setu.execute({
userId: "user_1",
action: "segment.get_workspace",
input: {},
});List audiencesreadsegment.list_audiencesList Engage audiences in a space (Unify/Engage required). The space id is in the space's settings URL.
| Input | Type | Description | |
|---|---|---|---|
space_id | string | Required | Space id |
count | integer | Optional | Page size |
cursor | string | Optional | Pagination cursor from the previous page's pagination.next |
await setu.execute({
userId: "user_1",
action: "segment.list_audiences",
input: {
"space_id": "<space_id>"
},
});List destinationsreadsegment.list_destinationsList the workspace's destinations with the source each one receives data from.
| Input | Type | Description | |
|---|---|---|---|
count | integer | Optional | Page size |
cursor | string | Optional | Pagination cursor from the previous page's pagination.next |
await setu.execute({
userId: "user_1",
action: "segment.list_destinations",
input: {},
});List functionsreadsegment.list_functionsList Functions of one type (source, destination or insert). The workspace needs Functions.
| Input | Type | Description | |
|---|---|---|---|
resource_type | string | Required | Function type |
count | integer | Optional | Page size |
cursor | string | Optional | Pagination cursor from the previous page's pagination.next |
await setu.execute({
userId: "user_1",
action: "segment.list_functions",
input: {
"resource_type": "<resource_type>"
},
});List sourcesreadsegment.list_sourcesList the workspace's sources with ids, slugs, enabled state and write keys.
| Input | Type | Description | |
|---|---|---|---|
count | integer | Optional | Page size |
cursor | string | Optional | Pagination cursor from the previous page's pagination.next |
await setu.execute({
userId: "user_1",
action: "segment.list_sources",
input: {},
});List tracking plansreadsegment.list_tracking_plansList Protocols tracking plans, optionally of one type. The workspace needs Protocols.
| Input | Type | Description | |
|---|---|---|---|
type | string | Optional | Only plans of this type |
count | integer | Optional | Page size |
cursor | string | Optional | Pagination cursor from the previous page's pagination.next |
await setu.execute({
userId: "user_1",
action: "segment.list_tracking_plans",
input: {},
});