Channels
Messaging channels
Voice and web chat carry conversations today. WhatsApp and Viber are on the list and are not in the first release; the API says which is which rather than letting you find out by trying.
Paths, field names, enum values, headers and error codes in these samples are the real ones, checked against the API's own specification when this page is built. The ids, amounts and names in them are illustrative. `$WETALK_API_KEY` and `$AGENT` are shell variables you set yourself.
Four media, two facts each
`availability` is a fact about WeTalk: `open` means the medium can be switched on at all, `waitlisted` means it cannot, and `waitlist_reason` says why. `state` is a fact about your workspace — whether you have connected it. Reading them as one value is how a console ends up offering a button that cannot work.
- voice — open. Connected on Numbers & SIP or on the agent's Channels tab, not here.
- web_chat — open. One script tag on your own page.
- whatsapp — waitlisted.
- viber — waitlisted.
curl https://api.wetalk.io/v1/messaging/media \
-H "Authorization: Bearer $WETALK_API_KEY" Connecting one
Binding a medium to an agent is one request. It is refused with `409` for a waitlisted medium and for `voice` — numbers and SIP trunks are the Numbers and SIP surface, and binding a number in two places is how one of them ends up wrong. The refusal says which of the two it is.
For web chat the binding id **is** the widget key. It is pasted into your own page, carries no scope and is not a secret, which is the only shape a public identifier can safely have.
curl https://api.wetalk.io/v1/messaging/media/web_chat/connection \
-X POST \
-H "Authorization: Bearer $WETALK_API_KEY"
-H "Content-Type: application/json" \
-H "Idempotency-Key: 0199f1c2-6b46-7b58-9299-7e5f0a81c376" \
-d '{
"voice_agent_id": "0199f1c2-6b40-7a11-9d3e-6c1b5f0a2e77"
}' {
"data": {
"channel_binding_id": "0199f1c2-6b47-7c69-83aa-8f601b92d487",
"medium": "web_chat",
"voice_agent_name": "Roma orders",
"widget": {
"widget_key": "0199f1c2-6b47-7c69-83aa-8f601b92d487",
"script_path": "/v1/widget/chat.js"
}
}
} Turning one off
Disconnecting stops the agent answering on that medium and keeps the history. Conversations already in flight are not cut off, for the same reason publishing a version does not cut off a call.
curl https://api.wetalk.io/v1/messaging/media/web_chat/disconnection \
-X POST \
-H "Authorization: Bearer $WETALK_API_KEY" Everything that is not a phone call
Messaging conversations are read from their own list, filtered the same way and paginated the same way as voice. A conversation is a conversation whatever carried it: the same metered unit, the same concurrency limit, the same transcript.
That is also how messaging is billed — by active conversation time, at the same rate as a call, never per message.
curl -G https://api.wetalk.io/v1/messaging/conversations \
-H "Authorization: Bearer $WETALK_API_KEY"
--data-urlencode "limit=25"