Setu Recipes: reusable digital workers across every app.Browse templates

Integrations / Twilio

Twilio

Twilio REST API (read-only): list and fetch SMS/MMS messages and calls, list your phone numbers, fetch the account and read usage records. Sending SMS is not included because Twilio's Messages API only accepts form-encoded requests.

8 actions API key 8 read0 write Calls api.twilio.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "twilio" });
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 accountreadtwilio.get_accountFetch the account: friendly name, status (active, suspended, closed) and type (Trial or Full).
InputTypeDescription
account_sidstringRequiredTwilio Account SID (starts with AC); the account the credentials belong to
TypeScript
await setu.execute({
  userId: "user_1",
  action: "twilio.get_account",
  input: {
    "account_sid": "<account_sid>"
  },
});
Get callreadtwilio.get_callFetch one voice call by its SID (CA...) including status, duration and price.
InputTypeDescription
account_sidstringRequiredTwilio Account SID (starts with AC); the account the credentials belong to
call_sidstringRequiredCall SID, starts with CA
TypeScript
await setu.execute({
  userId: "user_1",
  action: "twilio.get_call",
  input: {
    "account_sid": "<account_sid>",
    "call_sid": "<call_sid>"
  },
});
Get messagereadtwilio.get_messageFetch one SMS/MMS message by its SID (SM...) including status, price and any error code.
InputTypeDescription
account_sidstringRequiredTwilio Account SID (starts with AC); the account the credentials belong to
message_sidstringRequiredMessage SID, starts with SM or MM
TypeScript
await setu.execute({
  userId: "user_1",
  action: "twilio.get_message",
  input: {
    "account_sid": "<account_sid>",
    "message_sid": "<message_sid>"
  },
});
Get phone numberreadtwilio.get_phone_numberFetch one owned phone number by its SID (PN...).
InputTypeDescription
account_sidstringRequiredTwilio Account SID (starts with AC); the account the credentials belong to
phone_number_sidstringRequiredIncoming phone number SID, starts with PN
TypeScript
await setu.execute({
  userId: "user_1",
  action: "twilio.get_phone_number",
  input: {
    "account_sid": "<account_sid>",
    "phone_number_sid": "<phone_number_sid>"
  },
});
List callsreadtwilio.list_callsList voice calls on the account, newest first, optionally filtered by number or status.
InputTypeDescription
account_sidstringRequiredTwilio Account SID (starts with AC); the account the credentials belong to
tostringOptionalOnly calls to this number
fromstringOptionalOnly calls from this number
statusstringOptionalOnly calls with this status
page_sizeintegerOptionalRecords per page, up to 1000 (default 50)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "twilio.list_calls",
  input: {
    "account_sid": "<account_sid>"
  },
});
List messagesreadtwilio.list_messagesList SMS/MMS messages on the account, newest first, optionally filtered by recipient, sender or the day sent.
InputTypeDescription
account_sidstringRequiredTwilio Account SID (starts with AC); the account the credentials belong to
tostringOptionalOnly messages to this number (E.164)
fromstringOptionalOnly messages from this number (E.164)
date_sentstringOptionalOnly messages sent on this GMT date, YYYY-MM-DD
date_sent_beforestringOptionalOnly messages sent on or before this GMT date, YYYY-MM-DD
date_sent_afterstringOptionalOnly messages sent on or after this GMT date, YYYY-MM-DD
page_sizeintegerOptionalRecords per page, up to 1000 (default 50)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "twilio.list_messages",
  input: {
    "account_sid": "<account_sid>"
  },
});
List phone numbersreadtwilio.list_phone_numbersList the phone numbers owned by the account with their capabilities and webhook URLs.
InputTypeDescription
account_sidstringRequiredTwilio Account SID (starts with AC); the account the credentials belong to
friendly_namestringOptionalFilter by friendly name
phone_numberstringOptionalFilter by number; partial numbers allowed
page_sizeintegerOptionalRecords per page, up to 1000 (default 50)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "twilio.list_phone_numbers",
  input: {
    "account_sid": "<account_sid>"
  },
});
List usage recordsreadtwilio.list_usage_recordsRead what the account used and spent per category (sms, calls, ...) over a date range.
InputTypeDescription
account_sidstringRequiredTwilio Account SID (starts with AC); the account the credentials belong to
categorystringOptionalUsage category, e.g. sms, calls, totalprice
start_datestringOptionalOn or after this GMT date, YYYY-MM-DD, or an offset like -30days
end_datestringOptionalOn or before this GMT date, YYYY-MM-DD
include_subaccountsbooleanOptionalInclude subaccounts (default true)
page_sizeintegerOptionalRecords per page, up to 1000 (default 50)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "twilio.list_usage_records",
  input: {
    "account_sid": "<account_sid>"
  },
});