Twilio · Send a WhatsApp message (Twilio) — Sends a WhatsApp message from a Twilio sender — sends a WhatsApp message through your Twilio account. WhatsApp allows free text only to someone who has written to you in the last 24 hours; at any other time you send a template WhatsApp has approved.

Who can do this

Workspace Admins and Editors, on every plan. Viewers see the step's settings but cannot change them.

Before you start

  • A Twilio connection in this workspace — see Connect Twilio.
  • A WhatsApp sender in Twilio: a number registered with WhatsApp through Twilio, or Twilio's WhatsApp sandbox for trying it out. With the sandbox, the person must first send its join phrase to the sandbox number, as Twilio's Console shows.
  • To write outside the 24-hour window, a Content template approved by WhatsApp, made in the Twilio Console under Messaging › Content Template Builder. Its SID starts with HX.

Steps

  1. Select + where the message should be sent. In the step picker, open Apps, select Twilio, then Send a WhatsApp message (Twilio).
  2. In Connection, choose your Twilio connection.
  3. In From, choose the WhatsApp sender's number — A WhatsApp-enabled Twilio sender. The sandbox number is not in the list: select Use a value and type it, for example +14155238886.
  4. In To, the person's WhatsApp number with + and the country code — for example +919876543210 (an example number).
  5. Then either:
    • Inside the 24-hour window: in Message, type the text — Needed unless a Content template is set. Inside WhatsApp's 24-hour window; outside it, use a Content template.
    • Outside it: in Content template, the template's SID — Optional — a Content template's SID, approved by WhatsApp. Then under Template variables, select Add a field for each numbered variable: type its number — 1 — and in Value what fills it, such as {{ $json.name }}. Message is not used when a template is set.
  6. Select Run this step to send a test.

You do not need to type whatsapp: before the numbers — the step adds it.

Output

Field What it is
id Twilio's id for the message — it starts with SM or MM. Check its delivery later with Get a Twilio message.
status Usually queued.
from, to The sender and the person, as whatsapp:+….
body The text as Twilio took it.
price, priceUnit The price, once Twilio knows it.
errorCode, errorMessage Empty when Twilio accepted it.

Good to know

  • The step succeeds when Twilio accepts the message. A free-text message outside the 24-hour window is accepted, then fails — Get a message shows errorCode 63016. Use a template for anyone who has not written in the last day.
  • Template variables are the numbers in the template — {{1}}, {{2}} — and the text each takes. A number listed twice takes the last value.
  • A messaging service in From sends from the WhatsApp senders in that service.
  • Runs once per item. WhatsApp and Twilio bill each message.

If something goes wrong

What you see Why What to do
Message is empty when the step ran — an earlier step may not have given the value it names. Neither Message nor Content template has a value. Fill in one of them.
Twilio refused: Twilio could not find a Channel with the specified From address From is not a WhatsApp sender in this account. Choose the WhatsApp-enabled number, or type the sandbox number.
Twilio refused: … naming the Content SID or template The template SID is wrong, or the template is not approved. Copy the HX… SID from the Content Template Builder, and check it is approved for WhatsApp.
errorCode 63016 on Get a message Free text outside the 24-hour window. Send a template instead.
errorCode 63015 on Get a message The sandbox, and the person has not joined it. They send the join phrase to the sandbox number first.
To is empty when the step ran — … The value came out empty. Check the value it reads.
Twilio refused: Authenticate. Check the connection's details on Connections. The Auth Token was changed in Twilio. Revoke the connection and reconnect it with the new token.