Twilio

Send SMS messages and make phone calls with Twilio.

CommunicationCredentials form6 actionsAll integrations

On this page
  1. Connect
  2. Call it from a workflow
  3. Actions (6)
  4. get_message
  5. make_call
  6. send_sms
  7. custom_api_call
  8. download_recording_media
  9. phone_number_lookup
  10. Details

Connect

Auth type: Credentials form (custom_auth). Pass the fields the provider needs (listed below) as the connection's credentials. They are sealed at rest.

FieldTypeDescription
accountSidrequiredtextYour Twilio Account SID
authTokenrequiredsecretYour Twilio Auth Token
  • From your agent: integrations {action: "connect", piece, credentials, env} stores the credentials for dev, prod or all. Answers name the fields, never the values.
  • Or set the integration's project secrets with the secrets tool (SLACK_BOT_TOKEN, DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN, TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN …): a call uses the connection, else those secrets. integrations {action: "catalog", piece} lists which ones work.
  • Try one action now with integrations {action: "call", piece, piece_action, input}. It really sends.

Call it from a workflow

step.ctx.integrations.invoke("twilio", action, input) resolves with the provider's answer and rejects when Twilio isn't connected or refuses. Wrap it in step.run so a retry sends once. See step.ctx. send_sms runs in the platform itself; the other actions run through the integration runner, which the server's operator turns on.

Workflow
// workflows/notify.ts: call Twilio when a booking is confirmed
import { on } from "@appbricx/workflows";

export const tellTwilio = on.transition("booking", "status", "confirmed", async (_event, step) => {
  // Recorded once: a retry doesn't send it twice. Rejects when Twilio isn't connected.
  const output = await step.run("Twilio", () =>
    step.ctx.integrations.invoke("twilio", "get_message", {
      "message_sid": "<message sid>"
    }),
  );
  step.ctx.log("Twilio answered", output);
});
Try it from your agent
{
  "name": "integrations",
  "arguments": {
    "project_id": "<project-id>",
    "action": "call",
    "piece": "twilio",
    "piece_action": "get_message",
    "input": {
      "message_sid": "<message sid>"
    },
    "env": "dev"
  }
}
From another backend (connector proxy)
curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/twilio/get_message" \
  -H "Authorization: Bearer $APP_KEY" \
  -H "content-type: application/json" \
  -d '{"props":{"message_sid":"<message sid>"}}'

Actions

get_message

Get Message. Retrieves the details of a specific message.

InputTypeDescription
message_sidrequiredtextThe unique identifier (SID) of the message to retrieve. It starts with "SM" or "MM".

make_call

Call Phone. Call a number and say a message.

InputTypeDescription
fromrequiredid (picked from your account)The phone number to send the message from
torequiredtextThe phone number to call. Must be in E.164 format (e.g., +15558675310).
messagerequiredlong textThe text message to be converted to speech and spoken to the recipient.
voiceoptionalone of "alice" | "man" | "woman"The voice to use for the text-to-speech message.
languageoptionalone of "en-US" | "en-GB" | "es-ES" | "fr-FR" | "de-DE"The language to use for the text-to-speech message.
sendDigitsoptionaltextA string of keys to dial after the call is connected. Use 'w' for a half-second pause.
timeoutoptionalnumberThe number of seconds to let the phone ring before assuming no answer. Default is 60.

send_smsbuilt in

Send SMS. Send a new SMS message

InputTypeDescription
fromrequiredid (picked from your account)The phone number to send the message from
bodyrequiredtextThe body of the message to send
torequiredtextThe phone number to send the message to

custom_api_call

Custom API Call. Make a custom API call to a specific endpoint

InputTypeDescription
urlrequiredobject (depends on other props)url
methodrequiredone of "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD"Method
headersrequiredobjectAuthorization headers are injected automatically from your connection.
queryParamsrequiredobjectQuery Parameters
body_typeoptionalone of "none" | "json" | "form_data" | "raw"Body Type
bodyoptionalobject (depends on other props)Body
response_is_binaryoptionalbooleanEnable for files like PDFs, images, etc.
failsafeoptionalbooleanNo Error on Failure
timeoutoptionalnumberTimeout (in seconds)
followRedirectsoptionalbooleanFollow redirects

download_recording_media

Download Recording Media. Download the media file for a specific recording.

InputTypeDescription
recording_sidrequiredtextThe unique identifier (SID) of the recording to download. It starts with "RE".
formatoptionalone of "mp3" | "wav"The desired audio format for the download file.
channelsoptionalone of "1" | "2"Specify whether to download a mono or dual-channel file. Note: Dual-channel may not be available for all recordings.

phone_number_lookup

Phone Number Lookup. Lookup information about a phone number.

InputTypeDescription
phone_numberrequiredtextPhone Number

Details

Id
twilio
Category
Communication
Tags
sms, voice, phone, messaging
Package
@activepieces/piece-twilio@0.4.5
Runs
send_sms in the platform; the rest through the integration runner