Skip to main content

Twilio integration

Send and schedule SMS, MMS, voice and WhatsApp, run Studio flows and Verify OTP, fetch recordings and transcripts, and react to messages, calls and delivery events on Twilio.

What it does

The Twilio integration lets your agency run a client's messaging and voice program from inside a workflow. Connect a client's Twilio account once and your workflows can send SMS, MMS, and WhatsApp messages, schedule messages through a Messaging Service, place, redirect and end calls, start Twilio Studio flows, look up phone-number details, run Verify one-time-passcode flows, post messages into Twilio Conversations, download call recordings and message media, read transcripts, and clean up message, call and recording history. Triggers start a workflow when a message or call arrives, when a delivery status or call status changes, when a recording or transcript is ready, when Twilio raises a debugger alert, and when a number is added to the account.

Twilio connects with an Account SID and Auth Token, not an OAuth sign-in. Every trigger and action is currently in beta.

Connect a Twilio account

Twilio uses API-key credentials, so you paste two values rather than authorizing through a redirect.

  1. Open Connections

    Open your workspace in TaskJuice and go to Connections.
  2. Start the Twilio connection

    Choose Twilio and click Connect.
  3. Sign in to the Twilio Console

    In a new tab, sign in to the Twilio Console at console.twilio.com as the client, or as your agency if the client has delegated credentials to you.

  4. Copy your Account SID and Auth Token

    Under Account Info, copy the Account SID (it starts with AC) and the Auth Token.

  5. Save the connection

    Paste both values into TaskJuice and save the connection. The Auth Token is stored encrypted and is never shown again in the browser.

The connection form has exactly two fields.

FieldTypeRequiredDefaultDescription
accountSidtextYesnoneYour Twilio Account SID (starts with AC).
authTokentext (sensitive)YesnoneYour Twilio Auth Token. Stored encrypted, and also used to verify the signature on every webhook Twilio sends.

The Auth Token is the master credential for the entire Twilio account. Treat it like a password: store it only in TaskJuice and rotate it from the Twilio Console if it is ever exposed.

Rotating the Auth Token re-keys inbound verification

TaskJuice verifies inbound SMS and call webhooks with your Auth Token. When you rotate the token in the Twilio Console, update the TaskJuice connection right away, or inbound signature verification will start failing.

Triggers

Every trigger is in beta and requires a connection. Webhook triggers verify Twilio's request signature before they activate; one inbound POST starts one workflow activation.

TriggerSlugKindFires when
Incoming SMStwilio/incoming-smswebhookAn SMS or MMS arrives on one of your numbers.
Incoming WhatsApp Messagetwilio/incoming-whatsapp-messagewebhookA WhatsApp message arrives on your WhatsApp sender.
Message Status Updatedtwilio/message-status-updatedwebhookAn outgoing message is queued, sent, delivered, undelivered, failed or read.
Incoming Calltwilio/incoming-callwebhookA call comes in to one of your numbers (see the note below).
Call Status Changedtwilio/call-status-changedwebhookA call rings, is answered, or ends — with its duration once it is over.
New Recordingtwilio/new-recordingwebhookA call recording is ready to download.
New Transcriptiontwilio/new-transcriptionwebhookA voicemail recorded with <Record transcribe="true"> has been transcribed.
Intelligence Transcript Availabletwilio/intelligence-transcript-availablepollingA Conversational Intelligence transcript finishes (checked every 15 minutes by default).
New Debugger Alerttwilio/new-alertwebhookTwilio logs an error or warning for the account.
New Phone Numbertwilio/new-phone-numberpollingA number is bought or ported into the account (checked hourly by default).
Phone Calltwilio/phone-callmanagedA voice call arrives and the workflow ANSWERS it with a Voice Agent.

Point Twilio at TaskJuice

The webhook triggers share one TaskJuice webhook URL for your workspace's Twilio connection, shown in the trigger's panel. Paste it wherever Twilio asks for a callback URL; TaskJuice works out which trigger a request belongs to from the fields Twilio sends, so the same URL can sit in every slot:

TriggerWhere to paste the URL in Twilio
Incoming SMSThe number's A message comes in URL (Phone Numbers > Active numbers > Messaging), or a Messaging Service's incoming URL.
Incoming WhatsApp MessageThe WhatsApp sender's Webhook URL for incoming messages.
Message Status UpdatedA Messaging Service's Delivery Status Callback, or the Status Callback URL field of Send SMS, Send MMS or Schedule Message.
Incoming CallThe number's A call comes in URL.
Call Status ChangedThe number's Call status changes URL, or the Status Callback URL field of Make Call.
New RecordingThe recordingStatusCallback of a <Record>, <Dial> or <Conference> verb.
New TranscriptionThe transcribeCallback of a <Record> verb.
New Debugger AlertConsole > Monitor > Logs > Errors > Webhook & Email Triggers.

The Configure Phone Number Webhooks action sets a number's messaging, voice and status URLs for you.

Twilio signs each request with an HMAC-SHA1 over the request URL plus the alphabetically sorted POST parameters and sends the base64 digest in the X-Twilio-Signature header. TaskJuice verifies that signature with your Auth Token before activating the workflow. No extra shared-secret header is required.

Incoming Call ends the call

Twilio expects call instructions (TwiML) back from the "A call comes in" URL, and TaskJuice returns none, so Twilio ends the call after Incoming Call fires. To answer callers use the Phone Call trigger; to log calls without interrupting them use Call Status Changed.

Incoming Call and Phone Call are not two ways of doing one thing. Incoming Call tells you a call happened and lets the workflow react afterwards — it acknowledges Twilio immediately and runs in the background. Phone Call answers the caller: it holds the connection open while the workflow runs and a Voice Agent node speaks to the person on the line.

Phone Call

The Phone Call trigger is the front door for a voice agent. Pick the Twilio number the workflow should answer, add a Voice Agent node downstream, and publish.

  1. Add the trigger

    In the workflow editor, add the Twilio Phone Call trigger and choose your Twilio connection.

  2. Pick the number

    Choose a number from the Phone number dropdown. The list is read live from your Twilio account. Expressions are not available here: publishing changes this number's settings, so it has to be a concrete number rather than one computed at run time.

  3. Answer the call

    Add a Voice Agent node downstream of the trigger and give it a realtime model, a system prompt and, optionally, tools. The Voice Agent is what answers; without one the workflow has nothing to say and the publish bar refuses it.

What publishing does to the number

Publishing a workflow with a Phone Call trigger points the number's voice URL at TaskJuice. TaskJuice does this for you through Twilio's API — you never paste a URL into the Twilio Console.

Before it changes anything, TaskJuice takes a snapshot of the number's four voice fields as they are: VoiceUrl, VoiceMethod, VoiceFallbackUrl and StatusCallback. It then sets VoiceUrl to the workflow's ingress URL and VoiceMethod to POST.

Unpublishing (or deleting the workflow) restores that snapshot, field for field, so the number goes back to whatever it was pointing at before — an IVR, another platform, or nothing. A number can only be pointed at one workflow at a time: publish or activate a second workflow on the same number and TaskJuice refuses it rather than overwriting the first workflow's claim. The error names the workflow that holds the number. Unpublish or deactivate that workflow first.

The number answers TaskJuice while the workflow is published

Anything else that was answering that number stops answering it. If the number is in production for a client, use a spare number until you have heard the agent yourself.

Transfers

A Voice Agent can transfer the caller to a person on one of the numbers you list. A transfer is a second, outgoing call placed on the same connected Twilio account, and Twilio bills the two calls separately, each per minute and rounded up to the next minute: the inbound call the agent answered, and the outgoing call to the person.

The spend TaskJuice shows on the run for a transfer is an estimate at Twilio's list price, counted by the second. Because Twilio rounds each call up to the whole minute, the estimate can be up to a minute's charge low for each of the two calls. It also leaves out anything Twilio charges for the spoken note the person hears and for the no-answer message. Your Twilio invoice is the exact figure.

What number the person sees is set on the transfer tool: see Caller ID.

Phone Call payload

The trigger's output is Twilio's inbound voice webhook, so it carries the same fields as Incoming Call: CallSid, AccountSid, From, To, CallStatus, Direction, and the optional CallerName / geo fields. The call's transcript, recording and summary are the Voice Agent's output, not the trigger's — they only exist once the call has ended.

Response mode

Phone Call always answers synchronously through the Voice Agent node; there is no Response mode to choose. TaskJuice has 10 seconds to answer Twilio, so a slow step between the trigger and the Voice Agent (an HTTP call, an AI step) is a real risk — the publish bar warns you when it sees one. See the webhook response-modes reference.

Incoming SMS payload

FieldTypeAlways presentDescription
MessageSidstringYesUnique id of the inbound message.
AccountSidstringYesThe receiving account's SID.
FromstringYesSender's phone number.
TostringYesRecipient (your Twilio) number.
BodystringYesText body of the message.
NumMediastringNoCount of media items, as a string.
FromCitystringNoSender city, if Twilio has geo data.
FromStatestringNoSender state, if available.
FromCountrystringNoSender country, if available.
ToCitystringNoRecipient city, if available.
ToStatestringNoRecipient state, if available.
ToCountrystringNoRecipient country, if available.

Incoming Call payload

FieldTypeAlways presentDescription
CallSidstringYesUnique id of the inbound call.
AccountSidstringYesThe receiving account's SID.
FromstringYesCaller's phone number.
TostringYesCalled (your Twilio) number.
CallStatusstringYesCall status, for example ringing or in-progress.
DirectionstringNoCall direction (inbound).
CallerNamestringNoCaller name, if available.
FromCitystringNoCaller city, if available.
FromStatestringNoCaller state, if available.
FromCountrystringNoCaller country, if available.
ToCitystringNoCalled-number city, if available.
ToStatestringNoCalled-number state, if available.
ToCountrystringNoCalled-number country, if available.

Actions

The integration ships 37 actions, all in beta, all requiring a connection. Where a field reads "From Phone Number (dropdown)," TaskJuice loads your account's incoming Twilio numbers into a picker so you select instead of pasting an SID. Verify Service, Messaging Service and Studio flow dropdowns work the same way. Each picker loads up to 200 entries.

Messaging

twilio/send-sms sends an SMS to a phone number.

FieldTypeRequiredDefaultDescription
fromdropdownYesnoneFrom Phone Number, picked from your account's numbers.
TostringYesnoneRecipient in E.164 format, for example +15551234567.
BodystringYesnoneMessage text, up to 1600 characters.
MediaUrlstringNononeA media URL; supplying it sends an MMS.
StatusCallbackstringNononeURL to receive delivery-status updates.

Output: sid, status, to, from, body, date_created, price, error_code (string or null).

twilio/send-mms sends a multimedia message with an image or media attachment.

FieldTypeRequiredDefaultDescription
fromdropdownYesnoneFrom Phone Number, picked from your account's numbers.
TostringYesnoneRecipient in E.164 format.
MediaUrlstringYesnoneURL of the media file to send.
BodystringNononeText to send alongside the media.

Output: sid, status, to, from, num_media, date_created.

twilio/send-whatsapp sends a WhatsApp message via Twilio. The From here is free text, not a dropdown.

FieldTypeRequiredDefaultDescription
TostringYesnoneRecipient in whatsapp:+15551234567 format.
FromstringYesnoneYour WhatsApp-enabled Twilio sender, in whatsapp:+14155238886 format.
BodystringYesnoneMessage text.
MediaUrlstringNononeA media URL to attach.

Output: sid, status, to, from, body.

twilio/get-message retrieves details of a specific SMS or MMS message.

FieldTypeRequiredDefaultDescription
messageSidstringYesnoneMessage SID (starts with SM).

Output: sid, status, to, from, body, date_created, date_sent, price, error_code (string or null), error_message (string or null).

twilio/list-messages lists SMS and MMS messages with optional filters.

FieldTypeRequiredDefaultDescription
TostringNononeFilter by recipient number.
FromstringNononeFilter by sender number.
DateSentstringNononeFilter by date in YYYY-MM-DD format.
PageSizenumberNo50Results per page, up to 1000.

Output: messages[] (each with sid, status, to, from, body, date_sent) plus next_page_uri (string or null).

twilio/send-conversation-message sends a message in a Twilio Conversation.

FieldTypeRequiredDefaultDescription
conversationSidstringYesnoneConversation SID (starts with CH).
BodystringYesnoneMessage text.
AuthorstringNononeIdentity of the message author.

Output: sid, conversation_sid, body, author, date_created.

Voice

twilio/make-call initiates an outbound phone call. Supply either inline TwiML or a TwiML URL, not both.

FieldTypeRequiredDefaultDescription
fromdropdownYesnoneFrom Phone Number, picked from your account's numbers.
TostringYesnoneCallee in E.164 format.
TwimlstringNononeInline TwiML instructions.
UrlstringNononeURL that returns TwiML.
StatusCallbackstringNononeURL to receive call-status updates.
TimeoutnumberNo60Seconds to wait for an answer.

Output: sid, status, to, from, direction, date_created.

twilio/get-call retrieves details of a specific phone call.

FieldTypeRequiredDefaultDescription
callSidstringYesnoneCall SID (starts with CA).

Output: sid, status, to, from, direction, duration, start_time, end_time, price.

twilio/list-recordings lists call recordings with optional filters.

FieldTypeRequiredDefaultDescription
CallSidstringNononeFilter by call SID.
DateCreatedstringNononeFilter by date in YYYY-MM-DD format.
PageSizenumberNo50Results per page, up to 1000.

Output: recordings[] (each with sid, call_sid, duration, date_created, status) plus next_page_uri (string or null).

Phone numbers

twilio/list-phone-numbers lists incoming phone numbers on the account.

FieldTypeRequiredDefaultDescription
PhoneNumberstringNononeFilter by phone number.
FriendlyNamestringNononeFilter by friendly name.

Output: incoming_phone_numbers[] (each with sid, phone_number, friendly_name, sms_url, voice_url, capabilities).

twilio/lookup-phone-number looks up information about a phone number using the Twilio Lookup v2 API.

FieldTypeRequiredDefaultDescription
phoneNumberstringYesnoneNumber to look up, in E.164 format.
FieldsstringNononeComma-separated data packages, for example line_type_intelligence,caller_name.

Output: phone_number, country_code, national_format, valid (boolean), calling_country_code, caller_name (object or null), line_type_intelligence (object or null).

twilio/configure-phone-number-webhooks updates webhook URLs for an incoming phone number.

FieldTypeRequiredDefaultDescription
phoneNumberSidstringYesnonePhone Number SID (starts with PN).
SmsUrlstringNononeSMS webhook URL.
SmsMethodenumNononeGET or POST.
VoiceUrlstringNononeVoice webhook URL.
VoiceMethodenumNononeGET or POST.
StatusCallbackstringNononeStatus callback URL.
StatusCallbackMethodenumNononeGET or POST.

Output: sid, phone_number, friendly_name, sms_url, voice_url, status_callback.

Verify

twilio/start-verification sends a verification code through Twilio Verify.

FieldTypeRequiredDefaultDescription
serviceSiddropdownYesnoneVerify Service, picked from your account's services.
TostringYesnonePhone number or email to verify.
ChannelenumYesnoneOne of sms, call, email, whatsapp.

Output: sid, status, to, channel, valid (boolean), date_created.

twilio/check-verification checks a verification code submitted by the user.

FieldTypeRequiredDefaultDescription
serviceSiddropdownYesnoneVerify Service, picked from your account's services.
TostringYesnonePhone number or email that was verified.
CodestringYesnoneThe code the user entered.

Output: sid, status, to, channel, valid (boolean), date_created.

More actions

ActionSlugWhat it does
Schedule Messagetwilio/schedule-messageSchedules an SMS, MMS or WhatsApp message 15 minutes to 35 days ahead through a Messaging Service (dropdown).
Cancel Scheduled Messagetwilio/cancel-scheduled-messageCancels a scheduled message before it sends.
Delete Messagetwilio/delete-messagePermanently deletes a finished message record.
List Message Mediatwilio/list-message-mediaLists the files attached to an MMS or WhatsApp message.
Download Message Mediatwilio/download-message-mediaDownloads one attached file as a TaskJuice file reference.
List Callstwilio/list-callsLists calls, filtered by number, status or start date.
Update Calltwilio/update-callRedirects a live call to new TwiML or a TwiML URL, or hangs it up.
Delete Calltwilio/delete-callPermanently deletes a finished call record.
Get Recordingtwilio/get-recordingReads a recording's duration, status and price.
Download Recordingtwilio/download-recordingDownloads a recording's audio as MP3 or WAV.
Delete Recordingtwilio/delete-recordingPermanently deletes a recording and its audio.
List Transcriptionstwilio/list-transcriptionsLists voicemail transcriptions on the account.
List Recording Transcriptionstwilio/list-recording-transcriptionsLists the transcriptions of one recording.
Get Transcriptiontwilio/get-transcriptionReads one transcription, including its text.
Start Studio Flowtwilio/create-studio-executionStarts a Studio flow (dropdown) for a contact, with optional JSON parameters.
Get Studio Executiontwilio/get-studio-executionReads a Studio execution's status and context.
List Studio Executionstwilio/list-studio-executionsLists a Studio flow's executions.
End Studio Executiontwilio/end-studio-executionStops an active Studio execution.
Delete Studio Executiontwilio/delete-studio-executionPermanently deletes a Studio execution.
Create Verify Servicetwilio/create-verify-serviceCreates a Twilio Verify service.
List Intelligence Transcriptstwilio/list-transcriptsLists Conversational Intelligence transcripts, filtered by service or source recording.
Get Intelligence Transcripttwilio/get-transcriptReads one Conversational Intelligence transcript.
Get Transcript Sentencestwilio/get-transcript-sentencesReads who said what, sentence by sentence, from a transcript.

Errors

When a Twilio call fails, TaskJuice maps the provider's HTTP status to a stable error code so your workflow can branch on it. Any response that does not map to a specific code surfaces as the generic UPSTREAM_REQUEST_FAILED.

HTTP statusError codeRetryableWhat to do
400VALIDATION_ERRORNoFix the request, for example a malformed E.164 number or a body over 1600 characters.
401AUTH_EXPIREDNoReconnect the Twilio account; the Account SID or Auth Token is invalid or rotated.
403FORBIDDENNoThe account cannot use this product or resource, for example Studio on a restricted subaccount.
404NOT_FOUNDNoConfirm the SID exists, for example the Message, Call, or Phone Number SID.
429RATE_LIMITEDYesTwilio is throttling. TaskJuice retries with backoff.
500PROVIDER_ERRORYesTwilio had a server error. TaskJuice retries.

Known limitations

  • Twilio connects with API-key credentials, not OAuth. There is no Connect-and-authorize redirect; you paste your Account SID and Auth Token. Every REST call authenticates with HTTP Basic, using the Account SID as the username and the Auth Token as the password.
  • Webhook triggers are set up by hand: Twilio has no API for registering an account-wide webhook, so you paste the TaskJuice URL into each Twilio slot listed above. Only the Phone Call trigger configures the number for you.
  • TaskJuice acknowledges Twilio's messaging webhook without a TwiML reply, so Twilio may log warning 12300 for each incoming message. That warning reaches New Debugger Alert if you route alerts here; filter on Level or the error code if it is noise.
  • Intelligence Transcript Available polls: Twilio signs the Conversational Intelligence webhook over a hash of its JSON body, which TaskJuice's Twilio signature check does not cover yet. It reads your newest 100 completed transcripts per check.
  • New Phone Number polls because Twilio sends no event when a number is added. It reads up to 1,000 numbers per check; numbers beyond the first 1,000 are not watched.
  • Inbound verification relies on the Twilio request signature. Every webhook trigger verifies the X-Twilio-Signature header before activating, using your Auth Token. Because the Auth Token is also the signing key, rotating it in the Twilio Console means you must update the TaskJuice connection promptly, or inbound webhooks will fail verification.
  • Every Twilio trigger and action is in beta.
  • Send SMS accepts up to 1600 characters in Body. Split longer content across multiple sends.
  • Phone numbers for SMS, MMS, and voice must be in E.164 format, for example +15551234567. WhatsApp uses the whatsapp:+... prefixed form for both To and From.
  • Send WhatsApp Message does not use the phone-number dropdown. You type the whatsapp:+... sender yourself, and it must be a WhatsApp-enabled Twilio sender.
  • List actions return one page per call. Each pages at up to 1000 results (default 50) and returns a next_page_uri for the following page.
  • There is no bulk-send action. To message many recipients, drive Send SMS from a Loop node over your recipient list.
  • The geo fields on the inbound triggers (FromCity, FromState, FromCountry, and their To equivalents) appear only when Twilio has location data for the number. Treat them as optional.
  • The Phone Call trigger answers INBOUND calls only. Placing a call and having the agent speak first is not available yet.
  • One number, one published workflow. TaskJuice refuses to publish or activate a workflow on a number another active workflow already answers, rather than silently taking it over. Unpublish or deactivate the other workflow first.
  • Rotating the Auth Token also breaks the Phone Call trigger's signature verification, and TaskJuice needs a valid connection to restore the number's previous voice URL when you unpublish. Update the connection before you unpublish.
Was this helpful?