whatsapp purpose. Your key needs Manage integrations.
1. Prepare the agent
Create or choose the agent that will answer on the client’s number (POST /agents or GET /agents). Keep its id, AGI-XXXXX.
2. Create the session when the client clicks “Connect WhatsApp”
body.id with the client it belongs to, then redirect the client to body.url. The link is valid for expires_in minutes (60 by default, 24 hours at most).
3. The client connects their number
On the Shortext page, the client logs in to Facebook, chooses or creates their Meta business portfolio and WhatsApp Business account, then adds and verifies their number. Shortext then sends them to:4. Confirm on your server
Show a waiting state on your return page, and confirm with your server:- listen to
hosted_session.completed/hosted_session.failedon your webhook (filter onpurposeif needed), or - call
GET /hosted-sessions/{session_id}.
result.channels lists the connected numbers:
id for the client: it is the channel_id to send messages from. On failed, show error and offer to try again with a new session.
5. Go further
- Send the client’s first messages with templates.
- Move the number to another agent with
PUT /channels/whatsapp/{id}/agent. - Connect a mailbox the same way with the
mailpurpose.