דלג לתוכן הראשי

WhatsApp

A WhatsApp connection is your business number on Meta's WhatsApp Cloud API. Messages people send to it can start flows, and flows can read the pictures and files people send and answer with text, up to three reply buttons, Meta-approved templates, documents and private links.

  • Needs a Meta business account
  • Admin to connect
  • 4 values from Meta

Which number​

ConnectionNumberWho it reaches
WhatsApp (Meta Cloud API)Your own business number, set up by you in this page.Anyone who writes to it.
WhatsApp (app's shared number)One number that your app's operator owns and shares between workspaces. It appears in Connectors with a lock icon, and you do not set it up.The members of your workspace, routed by the phone each of them verified.

The rest of this page is about your own number. On a shared number everything below about flows, steps and the 24-hour window applies in the same way. What differs: the number's templates are managed by its owner, so you see them read only, and a flow can write only to phones that members verified in your workspace.

Connect your number​

You need a WhatsApp Business account at Meta with a phone number, and four values from it. Lumen keeps them apart from the connection and never shows them again.

ValueWhere to find it at Meta
System user access tokenBusiness settings, System users, Generate token. It needs whatsapp_business_messaging and whatsapp_business_management.
App secretYour Meta app, App settings, Basic. It signs every message Meta sends to Lumen.
Phone number IDYour Meta app, WhatsApp, API setup. It is the id of the number, not the number itself.
WhatsApp Business account IDThe same page.
  1. In the sidebar, open Connectors, click Add connection and choose WhatsApp (Meta Cloud API).
  2. Give it a Name, such as Support line.
  3. Paste the System user access token, the App secret, the Phone number ID and the WhatsApp Business account ID.
  4. Click Test connection. Lumen reads the number from Meta and shows its display number and verified name. Then click Add WhatsApp (Meta Cloud API).
The Add connection panel for WhatsApp (Meta Cloud API). Name holds Support line. A note says the credentials are kept out of sight, stored apart from the connection and never shown again. Four empty fields follow: System user access token, App secret, Phone number ID and WhatsApp Business account ID. Test connection, Cancel and Add WhatsApp (Meta Cloud API) are at the bottom.The Add connection panel for WhatsApp (Meta Cloud API). Name holds Support line. A note says the credentials are kept out of sight, stored apart from the connection and never shown again. Four empty fields follow: System user access token, App secret, Phone number ID and WhatsApp Business account ID. Test connection, Cancel and Add WhatsApp (Meta Cloud API) are at the bottom.
Four values from Meta. The two secrets are hidden as you type.

Now tell Meta where to send messages. Open the connection and click Show webhook details. In your Meta app, open WhatsApp, Configuration, Webhook, paste the Callback URL and the Verify token, and subscribe to two fields:

FieldWhat it does
messagesThe messages people send.
message_template_status_updateKeeps your template statuses current as Meta reviews them.
The Webhook for Meta section of a WhatsApp connection, open. It says to paste the callback URL and verify token in the Meta app's WhatsApp configuration. The Callback URL and Verify token are shown in boxes with copy buttons, and a button to make a new verify token. Two webhook fields to subscribe to are listed: messages, the messages people send, and message_template_status_update, which keeps template statuses current. A Hide button follows.The Webhook for Meta section of a WhatsApp connection, open. It says to paste the callback URL and verify token in the Meta app's WhatsApp configuration. The Callback URL and Verify token are shown in boxes with copy buttons, and a button to make a new verify token. Two webhook fields to subscribe to are listed: messages, the messages people send, and message_template_status_update, which keeps template statuses current. A Hide button follows.
The callback URL and verify token are for Meta's webhook settings. The token shown is a placeholder.

Only an admin can see these details. Make a new verify token replaces the token: the old one stops working, so paste the new one in Meta and verify again.

The 24-hour window​

WhatsApp lets a business answer freely for 24 hours after the person last wrote to its number. This is the window. Outside it, Meta accepts only an approved template.

The person last wroteWhat a flow can send
Within 24 hoursText, reply buttons, documents, document links, templates.
Longer agoOnly an approved template.

The steps check the window before sending. If you send text or ask a question outside it and you named no template, Lumen does not fail the step. It sends its generic template with the message cut to one line, and holds the real message. When the person writes back or taps the template's button, the held message is delivered. A held message expires after 72 hours, and a held question when its wait ends. The step's whatsappStatus is held meanwhile.

The window belongs to the number and the person, so it is the same for every flow and workspace that uses the number.

Message templates​

Open the connection to manage templates without leaving Lumen. The Message templates section lists each template with its category, language, number of parameters and status: Approved, waiting for Meta to review it, Rejected by Meta (with the reason), paused or disabled.

A WhatsApp connection named Lumen Demo, Ready. Below the webhook section and a Test connection button, a section titled Message templates shows Synced just now, a refresh button and a New template button, then a button Add Lumen's generic templates. A table lists six templates with category, language and parameter count and a delete button each: receipt_ready, expense_approval, weekly_summary, spring_offer, order_shipped and winter_sale, with status icons for approved, waiting, rejected, paused and disabled.A WhatsApp connection named Lumen Demo, Ready. Below the webhook section and a Test connection button, a section titled Message templates shows Synced just now, a refresh button and a New template button, then a button Add Lumen's generic templates. A table lists six templates with category, language and parameter count and a delete button each: receipt_ready, expense_approval, weekly_summary, spring_offer, order_shipped and winter_sale, with status icons for approved, waiting, rejected, paused and disabled.
Templates are listed with their review status. Only an approved one can be sent.
  • Sync templates from Meta (the refresh button) reads them again. Meta also tells Lumen when a review ends.
  • New template opens a form. Give it a Name (lowercase letters, digits and underscores, like order_shipped), a Category (Utility for something the person asked for or already does with you, Marketing for offers and news, which Meta reviews more strictly), a Language, an optional Header, the Message with {{1}}, {{2}} where values go, Example values, an optional Footer and up to 10 Quick replies. A message may not start or end with a variable. The form checks these rules as you type and shows a preview. Click Send to Meta for review; review usually takes minutes.
  • Add Lumen's generic templates creates lumen_update and lumen_question, which Lumen sends when a message has to go outside the window.
  • The bin button deletes a template at Meta too. Meta blocks reusing the name of a deleted approved template for 30 days.

Start a flow from a message​

Add the trigger A WhatsApp message arrives. A person writing to your number, or tapping a button you sent, starts it.

The settings of the trigger A WhatsApp message arrives. Which address starts this flow shows Sales line, WhatsApp (Meta Cloud API). Start on offers all, text and buttons, with all selected. Only from these numbers is empty. Show typing while the flow works is switched on, with a note that it marks their message read and shows typing until the flow's first WhatsApp answer.The settings of the trigger A WhatsApp message arrives. Which address starts this flow shows Sales line, WhatsApp (Meta Cloud API). Start on offers all, text and buttons, with all selected. Only from these numbers is empty. Show typing while the flow works is switched on, with a note that it marks their message read and shows typing until the flow's first WhatsApp answer.
The trigger listens on one WhatsApp connection.
SettingDefaultWhat it does
Start on (only)allall, text (only typed messages) or buttons (only a tapped button).
Only from these numbers (from)AnyonePhone numbers with the country code.
Show typing while the flow works (showTyping)OnMarks their message read and shows "typing" until the flow's first WhatsApp answer, for up to about a minute and a half. Turn it off for a flow that never answers on WhatsApp.

The trigger gives the flow these fields: message (what they wrote, the title of the button they tapped, or a media caption), from (their number) and name, kind (text, button_reply, media or other), buttonId, conversationId, sessionId, messageId, connection, receivedAt, and for pictures and files mediaType, mediaCount and mediaError.

Pictures and files people send​

When someone sends a photo, a document or a sticker, Lumen takes the file from WhatsApp the moment the message arrives, with your number's own access, and the flow starts with it as the run's file. Steps that read files and AI agents see it as they see an email attachment. The message stays kind: media and its caption is message. mediaType is image, document or sticker, and mediaCount is 1. A document keeps the name the person gave it. A photo is named after its WhatsApp id, such as wamid-123.jpg.

Lumen takes pictures (JPEG, PNG, GIF, WebP), PDF, Word, Excel and PowerPoint files, plain text and CSV, up to 25 MB, the same limit as an email. It checks that the file really is what it says. Voice notes and videos are not taken.

If the file cannot be taken, the flow still starts, with no file and mediaCount 0, and mediaError says why, so the flow can answer the person:

mediaErrorMeaning
too_largeThe file is over 25 MB.
unsupported_typeA kind of file Lumen does not take, or one that is not what it claims to be.
expiredWhatsApp no longer has the file.
unavailableWhatsApp could not be reached.

A file from a person is outside data: a step that reads it marks it as untrusted for the model. Add a Branch on mediaCount or mediaError to ask the person to send the file again.

An AI agent after this trigger converses over the same WhatsApp conversation: it reads back the earlier turns and its reply can be sent with Send a WhatsApp message.

Answer on WhatsApp​

StepDoesWindow
Send a WhatsApp messageSends text (text, up to 4,096 characters).Inside, or held
Send a WhatsApp templateSends an approved template with template, language, params for {{1}}, {{2}} and buttonPayloads for its quick replies.Any time
Send a file on WhatsAppSends one of the run's files as a document in the chat (file, caption).Inside, or held
Send a document link on WhatsAppSends a private link to a file (file, caption, expiresDays).Inside, or held
Ask with buttons on WhatsAppSends a question with up to three buttons (id and a title of at most 20 characters). A tap starts your flow again with kind: button_reply and the button's id in buttonId.Inside, or held
Ask on WhatsApp and waitThe same, but the run waits for the tap and goes on with the answer. See Ask on WhatsApp.Inside, or a template

Every send step has the same three addressing settings:

  • Send from (connectorRef): the connection. Empty is the number the run's message came in on, else the workspace's only WhatsApp connection. With none or several the step fails and asks you to pick one.
  • To (to): a phone number in any format with the country code, or a placeholder. Empty answers whoever sent the message that started the run. A run that no WhatsApp message started needs it.
  • To a member (toMember): a member's sign-in email, used when To is empty. The member must have joined or verified their phone on the number, so no phone numbers sit in the flow.

Each step adds whatsappMessageId and whatsappStatus and sends once per attempt, so a step run again after a lost worker does not send twice.

Send a file on WhatsApp puts the file itself in the chat, as a document the person can open and forward, with your caption under it. File names the run's file (a name, or a placeholder); empty is its first PDF, or its first file. The file is uploaded to WhatsApp, which is run by Meta, so use it for what the person should have in their own chat. Up to 100 MB, and the caption up to 1,024 characters. Outside the 24-hour window it is held and sent when the person writes back, like text.

Send a document link on WhatsApp never uploads the file. It sends a message with a private link to the file in Lumen's storage and turns link previews off, so neither WhatsApp nor Meta fetches it. The link stops working after Link works for (days): 1 to 30, default 7. File names the run's file; empty is its first PDF, or its first file. Keep message text minimal for the same reason: what the person needs (a name, an amount), never the document's contents.

Flows that answer, read a picture and send a document​

whatsapp-support-reply.yaml
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
name: whatsapp-support-reply
namespace: tenant-acme
spec:
displayName: Acknowledge WhatsApp requests
triggers:
- id: msg
ref: {name: whatsapp-message-received}
connectorRef: {name: support-whatsapp}
config: {only: text, showTyping: true}
next: [reply]
nodes:
- id: reply
stepRef: {name: whatsapp-send-text}
config:
text: "Thanks {msg.name}, we got your message and will reply today."
next: [team]
- id: team
stepRef: {name: notify-in-app}
config:
to: admins
title: "WhatsApp from {msg.name}"
body: "{msg.name} ({msg.from}) wrote: {msg.message}"

The reply goes to whoever wrote, from the number the message came in on. The second flow reads a photo of a bank transfer that the person sent and answers with what it says. Its agent is handed the run's file, which is the photo.

whatsapp-read-transfer.yaml
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
name: whatsapp-read-transfer
namespace: tenant-acme
spec:
displayName: Read a bank transfer sent on WhatsApp
triggers:
- id: msg
ref: {name: whatsapp-message-received}
connectorRef: {name: support-whatsapp}
next: [read]
nodes:
- id: read
stepRef: {name: chat-agent}
config:
files: {mode: attach}
limits: {maxTurns: 2, maxTokens: 30000, maxMinutes: 3}
instructions: |
The person sent a screenshot of a bank transfer. Say the amount, the date and who it was paid to,
in one short line. If there is no picture ({msg.mediaError}), ask them to send it again.
next: [answer]
- id: answer
stepRef: {name: whatsapp-send-text}
config:
text: "{read.reply}"

The third flow starts from the invoice inbox and sends each PDF to a phone as a link that works for 3 days.

whatsapp-invoice-links.yaml
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
name: whatsapp-invoice-links
namespace: tenant-acme
spec:
displayName: Send invoices to Dana on WhatsApp
triggers:
- id: email
ref: {name: email-arrives}
connectorRef: {name: invoices-inbox}
config: {attachments: separate, requireAttachment: true}
next: [pdfs]
nodes:
- id: pdfs
stepRef: {name: keep-pdfs}
next: [send]
- id: send
stepRef: {name: whatsapp-send-document-link}
config:
connectorRef: support-whatsapp
to: "12025550143"
caption: "New invoice from {email.from}"
expiresDays: 3

The second flow sends to a number no WhatsApp message started, so it relies on the window: if the person has not written in 24 hours, Lumen holds the message and sends its generic template first. To always reach them, use a template of your own:

A template step, as a fragment of a flow's nodes
- id: notify
stepRef: {name: whatsapp-send-template}
config:
connectorRef: support-whatsapp
to: "12025550143"
template: receipt_ready
language: en
params: ["{email.from}", "{email.subject}"]

See the conversations​

The chat button on a connection's card opens Conversations: every conversation with its messages, delivery status (Sending, Sent, Delivered, Read, Failed), the window (Free replies until a time, or Only approved templates can be sent) and a link to the run that sent each message. It is read only: replies are sent by your flows. Only an admin sees all conversations. A member sees the conversation of the phone they verified.

Next steps​