Conversations
Start a conversation
Finds the one-to-one conversation for a phone number on the workspace’s active connection, or creates it. If you include body, the text is sent right away. Calling it again for the same number returns the existing conversation.
- Bearer API key
- Scope:
write - or app session
- Workspace:
X-Tenant-ID(optional with a key)
Headers
AuthorizationstringrequiredYour API key as
Bearer <key>. The wordBearerand the space are case-sensitive. Browser clients signed in to the app use the session cookie instead.X-Tenant-IDuuidoptionalWorkspace id. Optional with an API key (a key always acts in its own workspace); if you send it, it must match the key’s workspace. Required with a session cookie. You can pass
?tenant=<id>instead.
Body
application/jsonphonestringrequiredPhone number with country code. Spaces,
+and other non-digit characters are removed.bodystringoptionalOptional first message (text). Leave it out to only open the conversation.
channel_iduuidoptionalCloud API only: the Meta channel (phone number) to use. Defaults to the workspace’s primary Meta number.
Response
200 OKapplication/json
conversationConversationThe conversation.
Show child attributesHide child attributes16
iduuidConversation id. Use it in
/api/conversations/{id}paths.workspace_iduuidWorkspace the conversation belongs to.
whatsapp_jidstringWhatsApp chat id (JID), for example
15551234567@s.whatsapp.netfor a person or…@g.usfor a group.channel_providerenumHow the number is connected:
scan(linked by QR code) ormeta(WhatsApp Business Platform, Cloud API).channel_iduuidmay be absentThe Meta channel (phone number) the chat belongs to. Left out for QR-linked chats.
phone_number_idstringmay be absentMeta phone number id of the channel. Left out for QR-linked chats.
namestringDisplay name: the contact or group name, or
+<digits>for a chat started by phone number.typeenumindividualorgroup.phonestringmay be absentPhone number as digits only, without
+.group_subjectstringmay be absentGroup subject, for group chats.
avatar_urlstringmay be absentProfile picture URL, when one has been downloaded.
last_messagestringnullablePreview of the newest message: its text,
Photofor an image, or the file name (orDocument) for a document.nullwhen the chat has no messages.last_message_attimestampnullableTime of the newest message as an RFC 3339 string in UTC.
nullwhen the chat has no messages.unread_countintegerUnread incoming messages.
0after the chat is marked as read.assignee_iduuidmay be absentUser id of the assigned teammate (a user id, not a membership id). Left out when unassigned.
assignee_namestringmay be absentName of the assigned teammate.
messageMessagemay be absentThe sent message. Left out when no
bodywas given.Show child attributesHide child attributes15
iduuidMessage id in whatsappx.si.
whatsapp_message_idstringMessage id assigned by WhatsApp.
conversation_iduuidConversation the message belongs to.
sender_jidstringWhatsApp id (JID) of the sender. For your own messages, the connected number.
sender_namestringSender display name, when WhatsApp provides one (may be empty).
contentstringMessage text. On numbers linked by QR code, images and documents carry their caption here. On the Cloud API, non-text messages are stored as a placeholder such as
[image message].message_typestringtext,imageordocumenton numbers linked by QR code. Non-text messages received through the Cloud API keep the type name Meta sends (for exampleimageoraudio) and have no downloadable media.media_urlstringmay be absentPath of the downloaded media file, for example
/api/media/<workspace>/<file>. Prefix it withhttps://whatsappx.siand send your API key to download it.mime_typestringmay be absentMIME type of the media file.
file_namestringmay be absentOriginal file name of a document.
file_sizeintegermay be absentMedia size in bytes.
timestamptimestampWhen the message was sent on WhatsApp (RFC 3339).
from_mebooleantruefor messages sent from the connected number (by your team, the API or an automation).statusenumreceivedfor incoming messages,sentfor outgoing ones. Delivered and read receipts are not tracked.created_attimestampWhen whatsappx.si stored the message (RFC 3339).
Status codes
- 200OK. The conversation, plus the sent message when
bodywas given. - 400Bad request. Invalid input (
enter a valid international phone number,invalid channel_id,invalid request body), or an agent signed in to the app tried to open a new chat (agents can only open chats assigned to them). - 401Unauthorized. The API key is unknown, revoked or expired (
invalid or expired API key), or there is no key and no signed-in session (unauthorized). - 402Payment required. Only when subscriptions are enforced and the workspace has no active subscription. The body includes
code: "payment_required". - 403Forbidden. The API key has the
readscope, which only allows GET requests (API key is read-only). A key in another workspace getsAPI key belongs to a different workspace. - 409Conflict. No WhatsApp connection is ready to send (
whatsapp is not connected). - 502Bad gateway. The conversation was found or created, but the first message could not be sent (for example
message body too long, or WhatsApp rejected it). The response includes theconversation, so you can fix the text and retry with the send-message endpoint.
Things to know
- Only one-to-one chats can be started this way; group conversations appear when the linked number receives or syncs them.
- The new conversation’s
nameis the phone number (+<digits>) until WhatsApp provides a contact name. - Sessions with the agent role cannot start chats; API keys can.