Build a WhatsApp and SMS AI Agent
This guide builds one AI agent and puts it in front of customers on two channels — SMS for universal reach on any handset, WhatsApp for rich media and the 2 billion people already on it. The agent is defined once; deploying it to a second channel is a single extra API call, not a second integration.What you’ll build
- One agent (
POST /api/v1/agents) with a system prompt, a knowledge base, and guardrails. - The same agent deployed to SMS and WhatsApp, each bound to a phone
number with its own
deploycall. - No webhook server of your own, and no LLM calls to wire up — Orbit’s agent runtime receives the inbound message, runs the conversation, and sends the reply back over the channel it arrived on.
deploy call replaces: the runtime already speaks SMS and WhatsApp, so
there’s no relay to host or keep alive.
How it works
- A customer texts your number, or messages your WhatsApp Business number.
- Orbit’s agent runtime loads that contact’s conversation state.
- The runtime sends the conversation to Claude along with the agent’s tools and knowledge base.
- The agent’s response is sent back over the same channel the inbound message arrived on — SMS in, SMS out; WhatsApp in, WhatsApp out.
Prerequisites
- An Orbit account and an API key (Dashboard → Settings → API Keys).
- For WhatsApp: a WhatsApp Business Account (WABA) connected through the dashboard’s Embedded Signup flow — see WABA Setup if you haven’t connected one yet. You can also test against Orbit’s shared test WABA before connecting your own.
- A phone number with SMS capability. WhatsApp rides on the same E.164 number once it’s registered to your WABA, so you generally deploy both channels to one number.
Step 1 — Get a number
Search for an available number with SMS (and voice, if you want it later):phone_number field from the entry you want (e.g. +14155550123),
then buy it:
Step 2 — Create the agent
id (e.g. agent_abc123) — use it in the
steps below. See Creating Agents for the full
tools, guardrail, and escalation-trigger options.
Step 3 — Ground it in your content
Create a knowledge base, upload your docs, and link it to the agent sosearch_knowledge has something to retrieve from:
Step 4 — Deploy to SMS
Deploying is what binds the agent to a channel and number — there’s no separate “routing” step for messaging channels.$PHONE_NUMBER from your own phone — the agent replies within a few
seconds.
Step 5 — Deploy to WhatsApp
Repeat the deploy call withchannel set to whatsapp, using the same
number now that it’s registered to your WABA:
The agent’s replies are always sent in response to an inbound customer
message, so they always land inside Meta’s
24-hour customer-care window — no template
approval needed for the conversation itself. Templates only come into play
if you need the agent (or one of its tools) to message a customer who
hasn’t texted you in the last 24 hours.
Step 6 — Test before you go live
Replay a scripted conversation without sending a real message or spending LLM/channel cost on a live send:Writing one prompt for two channels
WhatsApp and SMS aren’t the same reading experience, so keep a few things in mind while both channels share a prompt:- Default to plain text. WhatsApp supports rich media, buttons, and list pickers; SMS doesn’t. Don’t have the agent reference a button or a list it can only render on one of the two channels.
- Keep replies short. SMS splits long messages into segments; WhatsApp readers are still on a phone screen. A concise system prompt (as above) keeps replies usable on both.
- Escalate the same way everywhere.
transfer_agentand yourescalation_triggers(keyword, sentiment, turn-count) work identically regardless of which channel the conversation is happening on.
Troubleshooting
See also
- Creating Agents — full agent configuration reference (tools, guardrails, escalation triggers).
- WhatsApp and SMS — channel-level API reference.
- WABA Setup — connecting your own WhatsApp Business Account.
- AI Voice Agents via
sip_forward— add a third channel, voice, to the same kind of setup. - Webhooks — subscribe to
agent.conversation.startedandagent.responseto observe conversations happening on either channel.