octo whatsapp: send templates
List the WhatsApp message templates of an agent and send a template message to a customer from the terminal with octo whatsapp.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
octo whatsapp lists the WhatsApp templates available to an agent and sends a template message to a phone number. Use it for one-off messages, tests of a new template, or scripts that notify customers, such as an order update.
Before you start
- Connect WhatsApp to the agent first. See WhatsApp.
- Create the template you want to send. See WhatsApp templates.
- Sign in to the CLI with octo auth.
Commands
| Command | What it does |
|---|---|
octo whatsapp templates |
Lists the templates for an agent. |
octo whatsapp send |
Sends a template message to one number. |
Both commands take --agent AGENT_ID, or use your defaultAgent setting.
List templates
octo whatsapp templates --agent agt_123
Sample output:
NAME LANGUAGE STATUS VARIABLES
order_update en approved 2
welcome_back en approved 1
Only templates listed here can be sent. If a template is missing, check its status in the WhatsApp templates settings of the dashboard.
Send a template message
octo whatsapp send \
--agent agt_123 \
--to +15555550123 \
--template order_update \
--language en \
--var 1="Dana" \
--var 2="A-1042"
| Flag | Description |
|---|---|
--to |
The recipient phone number with country code. |
--template |
The template name from the list. |
--language |
The template language code. Defaults to en. |
--var N=VALUE |
The value for variable number N. Repeat for each variable. |
--json |
Print the response as JSON. |
You should see a message id and the conversation it belongs to. A customer reply appears in that conversation, and the agent answers as usual.
Troubleshooting
not_found. The template name or language does not match any listed template.invalid_request. The number of--varvalues does not match the template, or the phone number is not in international format.forbidden. The agent has no WhatsApp connection. Connect the channel first.
Note: Use test numbers while you build a script. Template messages go to real people as soon as you run the command.
Related pages
- WhatsApp API lists the endpoints behind these commands.
- Outbound WhatsApp covers sending in bulk from the dashboard.