Skip to main content
Jinba Flow has two outbound Twilio tools and one inbound SMS/MMS input. Use Twilio credentials to set up the Account SID and Auth Token. The outbound tools require both credentials, either in tool configuration or the server environment.

Send an SMS

The Account SID and Auth Token are two separate secrets. Replace TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN with your secret names, and the numbers with your own. Use E.164 phone numbers with a leading +; from must be a Twilio number you own. On success, read {{steps.send_sms.result.message.sid}} and result.message.status (for example queued). If sending fails, confirm the credentials, sender number, destination, and Twilio account restrictions.

Send a WhatsApp message

Enter to and from as E.164 numbers without a whatsapp: prefix; the tool adds it and rejects any other format. from must be a WhatsApp-enabled Twilio sender. media_urls is optional: pass a JSON array of publicly accessible URLs, or a single URL. The result has the same shape as SMS: result.message.sid, result.message.status, and result.message.num_media. Supported media formats are JPEG, PNG, GIF, MP4, and PDF. To set up a test sender, follow Twilio’s WhatsApp documentation. Trial account recipient verification and messaging limits can change, so check Twilio’s current trial guidance before testing delivery.

Receive SMS or MMS from Twilio

  1. Set the step’s auth_token config to a secret of type TWILIO_AUTH_TOKEN and publish the flow. The auth_token is required: the endpoint runs the published version and answers 401 to every callback when that version has no usable Auth Token on its INPUT_TWILIO_SMS step.
  2. Set the Twilio number’s incoming message webhook to POST /api/v2/external/flows/:flowId/twilio-run, using your Jinba Flow host and published flow ID.
  3. Send a message to the Twilio number and check the flow run. Twilio sends form-encoded data by default; the endpoint returns an empty TwiML response while the flow runs.
The endpoint passes the webhook payload to every INPUT_TWILIO_SMS step, which parses it into result. Required fields include MessageSid, AccountSid, From, To, Body, and NumMedia; MMS messages add MediaUrl0–MediaUrl9 and MediaContentType0–MediaContentType9. Later steps read them as {{steps.receive_sms.result.Body}} or {{steps.receive_sms.result.From}}; to reply, send an SMS with to set to result.From and from set to result.To. If no event value is supplied or the payload is invalid, the tool returns INPUT_TWILIO_SMS_ERROR. Every callback is authenticated: the endpoint validates the X-Twilio-Signature header with the Auth Token from the published step’s auth_token config and answers 401 when the header is missing or the signature does not match. A retry of the same delivery is acknowledged without starting another run.