stateset-whatsapp is a long-running process that links a WhatsApp account as a
device, receives messages, hands them to an iCommerce agent, and sends the
agent’s reply back. It is the same pattern as the Discord, Telegram and Slack
gateways — only the link step differs.
Prerequisites
- A WhatsApp account you can reach Linked Devices on (the phone stays the primary device; the gateway is a second one).
- The iCommerce CLI installed and authenticated.
- A local iCommerce database, passed with
--db.
Connect WhatsApp and run the gateway
1
Start the gateway
2
Link the device
On your phone: WhatsApp → Settings → Linked Devices → Link a device, and
scan the code in your terminal.
3
Confirm the credentials were stored
Configuration
The gateway reads channel credentials from~/.stateset/channels.json, shared
with the other channel gateways:
Read-only until you say otherwise
By default the gateway answers questions but takes no action that changes data. Write actions — cancelling an order, issuing a refund, editing an address — require--apply:
Verify the result
Send a message to the linked WhatsApp account from another phone and confirm the agent replies:--db path points at a database with no order data,
or the account was messaged from a number the agent has no customer record for.
Related tasks
Messaging channels
The general pattern this gateway is one instance of — routing any channel
into an iCommerce agent.
iCommerce agent
What the gateway hands messages to, and how to shape its answers.
CLI workflows
The commands the agent runs when
--apply is enabled.Agent sandbox
Rehearse write actions against a sandbox database before enabling —apply.