LemuAIDocs

WhatsApp · 9 min read

WhatsApp Messaging

Send WhatsApp messages from a live call or a journey, and receive replies and delivery receipts, using your own WhatsApp Business provider

Open in ChatGPTOpen in ClaudeMarkdown

Lemu can send WhatsApp messages on your behalf, either while a voice agent is on a call or as a step inside a journey, and receive your customers' replies in the Inbox. Everything uses the same organization-level WhatsApp configuration, so you only connect a provider once.

WhatsApp sending shows up in four places:

  • A "Send Message" tool you attach to an agent node, so the model can send a WhatsApp message (a link, a confirmation, a follow-up) to the caller mid-conversation.
  • A message node inside a journey, so a workflow can text someone as one of its steps, for example after a call ends or when a trigger condition fires.
  • The Inbox, where your team and the AI assistant answer customers.
  • Your own system, through the API: Send a WhatsApp Template sends an approved template to one number with your API key, and Get a WhatsApp Message tells you whether it was delivered and read.

WhatsApp sending must go through an approved WhatsApp Business Solution Provider (BSP). Lemu does not provide WhatsApp numbers or templates itself; you connect your own provider account.

Connect a WhatsApp provider#

Configuration lives on the Integrations page (Settings → Integrations in the sidebar), in the WhatsApp messaging section. Choose one of the supported providers and save its credentials:

ProviderCredentials
WATIAPI endpoint, API token
Meta Cloud APIPhone number ID, access token, (optional) WhatsApp Business Account ID, needed to list templates, and App secret (recommended), used to check that webhooks really come from Meta
GupshupAPI key, source WhatsApp number, and (optional) app name, needed to list templates
Twilio WhatsAppAccount SID, auth token, WhatsApp-enabled from number, or reuse your existing telephony Twilio credentials

Saved secrets (API tokens, access tokens, auth tokens, app secret) are masked once stored. The dashboard shows them back as asterisks, and re-saving the form without touching a masked field keeps the existing value.

Once a provider is connected, use Test send on the same page to send a real WhatsApp template message to a number you specify. This confirms your credentials and template work before you wire them into a call or journey.

Receive replies and delivery receipts#

To see customer replies in the Inbox and know whether your messages were delivered and read, your provider must send them to Lemu. After you save a provider, the Receipts and replies section on the same page shows a Callback URL (and, for Meta, a Verify token) to copy, plus what to do at the provider:

ProviderWhere to set it
Meta Cloud APIIn your Meta app → WhatsApp → Configuration, set the Callback URL and Verify token, then subscribe to the messages field
Twilio WhatsAppDelivery receipts are requested on every send automatically. For customer replies, set the Callback URL as the "A message comes in" webhook (HTTP POST) on your WhatsApp sender
WATIIn WATI → Webhooks, add the URL and tick Message received, Template/Session message sent, Delivered, Read and Template message failed
GupshupIn your Gupshup app → Webhooks, add the URL and tick the sent, delivered, read and failed message events

The Callback URL is unique to your organization and provider. Keep it private. Lemu also checks the provider's own signature where the provider signs its webhooks (Meta with the app secret, Twilio with the auth token), and ignores anything that doesn't check out.

Once it is set up:

  • Delivery receipts update each message's status (sent, delivered, read or failed) in the Inbox, on the contact and in the Event Log (with Message updates ticked).
  • Customer replies appear in the Inbox and are recorded as a whatsapp_message_received event on the contact, which segments and journeys can use. A reply also opens WhatsApp's 24-hour window for free-form messages.

Opt-out and opt-in#

A customer stops your WhatsApp marketing when they reply with an opt-out word, tap Stop promotions on a marketing template, or choose Stop marketing for your business in WhatsApp itself. Lemu sets their WhatsApp consent to opted out. An opt-in word sets it back.

Opts outOpts in
STOP, STOP ALL, UNSUBSCRIBE, OPT OUT, STOP PROMOTIONS (Meta's opt-out button), बंद करेंSTART, SUBSCRIBE, UNSTOP, OPT IN, RESUME PROMOTIONS

Only a whole message counts: "stop" opts out, but "please don't stop my order" does not. Words like "cancel" or "end" are ignored on purpose, because customers use them about orders.

An opt-out stops marketing, as Meta's own opt-out does. Lemu doesn't send them broadcasts or marketing templates, whether the send comes from a call, a journey, a campaign or the API; the send fails with "This contact stopped marketing messages on WhatsApp". Replies in a chat they start (from the AI assistant, an agent or your team), utility templates such as order updates, and authentication codes still go.

A contact marked Opted out of everything gets nothing on any channel; the send fails with "This contact has opted out of all messages".

If Meta refuses a marketing message because the customer stopped marketing in WhatsApp (code 131050) and Lemu hadn't heard, Lemu records the opt-out then. See who opted out, and after which message, on WhatsApp analytics.

Session messages vs. template messages#

Every WhatsApp send is one of two kinds:

  • session: a free-form text message. This only works if the recipient has messaged your WhatsApp number within the last 24 hours (WhatsApp's session window).
  • template: a pre-approved WhatsApp message template. This works at any time, which makes it the right choice for anything business-initiated (outbound reminders, payment links, confirmations).

Templates must already be approved in your WhatsApp Business account. Lemu lists your approved templates by calling your provider's API. It doesn't create or submit templates for approval.

Working with templates#

Wherever you configure a WhatsApp send (the in-call tool, a journey node or the Inbox), you pick a template from a searchable picker that:

  • Loads your approved templates from the connected provider
  • Shows a WhatsApp-style preview of the template body, with {{variable}} placeholders highlighted
  • Lets you fill in a value (or a template expression like {{context.name}}) for each variable the template defines
  • Shows a URL button suffix field if the template has a URL button, so you can fill in the dynamic part of the link (for example, a payment or callback URL). For a button made with Count clicks on this button, the field asks for the whole page to open instead; see Link Click Tracking

If no approved templates are found, the picker falls back to a plain text field for the template name and shows a hint pointing back to the messaging configuration.

Sending WhatsApp during a call#

Attach a Send Message tool to an agent node so the model can send a WhatsApp message while the call is active. In the tool's configuration you set:

  • Destination: either the current caller (the tool defaults to the phone number on the call) or the model provides the number (the model must pass a phone number as an argument)
  • Message kind: session or template, and if template, which template and its variables and URL button suffix (with the same template picker described above)
  • Spoken line before sending: optional. None, or a custom line the agent says before it sends the message (for example, "I'm sending that on WhatsApp now.")

To add one, go to Agent Setup → Tools, click New, choose the Send Message type, then tick the tool in the Agent Node's tool list. See Tools Library.

At runtime, the model can still pass a link or name argument when it calls the tool. These fill in remaining template variables (a URL button suffix, or a name variable) even if you didn't set them at configuration time. If the destination is set to "current caller", Lemu resolves the recipient's number from the call itself; you don't need the model to know or repeat it.

Session messages sent from this tool only succeed if the caller has an open 24-hour WhatsApp session with your number. Otherwise, use a template.

Sending WhatsApp from a Journey#

Inside a journey, a message node sends a WhatsApp message as one step in the workflow. Its configuration includes:

FieldPurpose
to / to_fieldRecipient phone number, or a template expression that resolves to one (e.g. {{context.phone}})
kindsession or template
template_nameWhich approved template to send (required for template)
languageTemplate language code (defaults to en)
template_paramsValues for the template's variables, keyed by variable name or position (e.g. {"1": "{{context.name}}"})
button_url_suffixDynamic part of the template's URL button, if it has one

A message node fails validation (and won't run) if it's missing a recipient, a template send is missing a template, or a session send is missing a body.

See Journey Nodes & Triggers for how the message node fits alongside other journey steps.

Sending WhatsApp from your own system#

To send a template from your store, CRM or backend (an order update, a payment reminder, a login code), call Send a WhatsApp Template with an API key from Settings → API Keys. You send the template's id (the Template ID in its side panel under WhatsApp → Templates, or its name and language instead), the number, and the values for its variables:

JSON
{
  "to": "+919876543210",
  "template_id": 44,
  "variables": { "1": "Priya", "2": "SO-10422" }
}

The message is paid from your WhatsApp balance, is never sent to a contact who opted out of everything (nor a marketing template to one who stopped WhatsApp marketing), and shows in the contact's Inbox conversation labelled API. Check delivery with Get a WhatsApp Message.

Phone number format#

Recipient numbers should be in E.164 format (e.g. +919876543210). Lemu normalizes numbers before sending and rejects a number it can't send to. A 10-digit US-style number without a + is assumed to be +1; anything else without a recognizable country code is treated as invalid.

Troubleshooting#

  • "No organization on this call; cannot send a message": the call isn't associated with an organization. This shouldn't happen in normal use.
  • Messaging not configured: no WhatsApp provider has been saved for your organization yet, or the saved configuration is incomplete. Go to Settings → Integrations and save valid credentials for a provider.
  • No approved templates found: your provider account has no templates in an approved state, or a piece of provider config needed to list them is missing (Meta Cloud API needs a WABA ID; Gupshup needs an app name). Outbound WhatsApp must use an approved template outside the 24-hour session window.
  • Invalid recipient: the phone number couldn't be normalized to E.164. Check that the number (or the field or expression supplying it) includes a country code.
  • "This contact stopped marketing messages on WhatsApp": the contact replied STOP (or a similar word), tapped Stop promotions, or stopped marketing in WhatsApp, and this is a broadcast or a marketing template. They can opt back in by replying START.
  • "This contact has opted out of all messages": the contact is marked Opted out of everything.
  • Replies don't show up in the Inbox: check the webhook at your provider against Receipts and replies on the Integrations page. For Meta, make sure the messages field is subscribed and the app secret matches.
  • Provider rejected the send: Lemu shows the provider's error message as-is. Check the template's approval status and parameter count against what the provider expects.

Support#

If you run into an issue connecting a provider or sending a message, reach out to ashish@lemuai.com.

Was this page helpful?