Scroll down for example requests and responses.
Complete instant messaging API for WhatsApp Multi-Device & Business API.
Base URLs:
Authentication
- oAuth2 authentication.
- Flow: password
- Token URL = https://api-auth.twoway.ai/oauth2/token
SCOPE | SCOPE DESCRIPTION |
---|---|
ACCOUNT_READ | Read all available accounts |
ACCOUNTS_READ_ASSIGNED | Access to read assigned channels |
ACCOUNT_CREATE | Add an additional IM account |
ACCOUNT_PATCH | Update an existing IM account (open, close, logout etc) |
ACCOUNT_DELETE | Delete an IM account |
CHATS_ACCESS_ALL | Allow the access of All Chats |
CHATS_ACCESS_ASSIGNED | Allow the access of assigned Chats |
MESSAGES_SEND_TO_ASSIGNED | Allow the sending of Messages to Assigned |
MESSAGES_DELETE | Allow the deletion of Messages |
MESSAGES_SEND_TO_ALL | Allow the access of Messages to All |
GROUPS_UPDATE | Allow the updating of Groups |
GROUPS_CREATE | Allow the creating of Groups |
CONTACTS_READ_ALL | Read All contacts |
CONTACTS_READ_ASSIGNED | Read Assigned contacts |
CONTACTS_UPDATE | Allow the updating of contacts |
CONTACTS_DELETE | Allow the deletion of contacts |
CONTACTS_CREATE | Allow the creation of contacts |
TAGS_READ | Can read tags |
TAGS_DELETE | Allow the deletion of Tags |
TAGS_CREATE | Allow the creation of Tags |
TEMPLATES_CREATE | Allow the creation of Message Flows |
PRODUCTS_CREATE | Create a platform product |
PRODUCTS_UPDATE | Update a platform product |
PRODUCTS_DELETE | Delete a platform product |
Account
Code samples
GET /accounts
Get the list of all accounts
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
q | query | string | false | search accounts by ID/Nickname |
all | query | boolean | false | none |
state | query | AccountState | false | only fetch accounts with a state |
page | query | integer | false | none |
count | query | integer | false | none |
returnCount | query | boolean | false | return total count of accounts |
PARAMETER | VALUE |
---|---|
state | open |
state | connecting |
state | close |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» accounts | [Account] | true | none | none |
»»» tags | [ContactTag] | true | none | Tags associated with this contact |
»»» assignee | string¦null | false | none | The assignee of the contact |
»»» assigner | string¦null | false | none | The person who assigned this contact |
»»» messagesSent | number | true | none | none |
»»» messagesReceived | number | true | none | none |
»»» chat | object | false | none | none |
»»» sendButtonsAsPoll | boolean | false | none | Should polls be sent as buttons instead of a message. This is useful for the regular WhatsApp API |
»»» autoSyncProductsToPlatform | boolean | false | none | Should products be synced to WhatsApp automatically. |
» total | number | false | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: ACCOUNT_READ ACCOUNTS_READ_ASSIGNED )
Code samples
POST /accounts
Add a new account
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | object | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Account |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: ACCOUNT_CREATE )
Code samples
POST /accounts/{accountId}/open
Open connection to the account
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | None |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: ACCOUNT_PATCH )
Code samples
POST /accounts/{accountId}/close
Close connection to the account
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
logout | query | boolean | false | Closes the account and logs out from the account |
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | None |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: ACCOUNT_PATCH )
Code samples
POST /accounts/{accountId}/logout
Logout and clear credentials from the account
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: ACCOUNT_PATCH )
Code samples
PATCH /accounts/{accountId}
Update an account
Update name of the account or its settings
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
body | body | AccountsPatchRequest | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: ACCOUNT_PATCH )
Code samples
DELETE /accounts/{accountId}
Delete an account
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: ACCOUNT_DELETE )
Code samples
POST /accounts/{accountId}/archive
Archive an account. Logs out of the account & removes all synced chats, messages. Keeps contacts, and notes.
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: ACCOUNT_DELETE )
Chats
Code samples
GET /chats
Get chats
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
count | query | number | false | none |
page | query | string | false | none |
archive | query | boolean | false | none |
unread | query | boolean | false | none |
hasPendingMessage | query | boolean | false | none |
mentioned | query | string | false | none |
hasUnsolvedNote | query | boolean | false | none |
hasFailedMessage | query | boolean | false | none |
lastMessageFromMe | query | boolean | false | none |
tags | query | array[string] | false | Get contacts who fall in either of these tags |
notTags | query | array[string] | false | Get contacts who are not in any of these tags |
contacts | query | array[string] | false | Get these specific contact ids |
q | query | string | false | Search string for contact name/phone number/email |
assignee | query | array[string] | false | Get contacts assigned to the specified users |
accountId | query | array[string] | false | Get contacts only belonging to this account |
type | query | string | false | only get contacts of type |
returnUnreadChatCount | query | boolean | false | none |
PARAMETER | VALUE |
---|---|
type | group |
type | individual |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» nextPage | string | false | none | next page cursor, if it exists |
» unreadChatCount | number | false | none | number of total unread chats given the filter |
» hasMoreUnread | boolean | false | none | the API counts at most N unread chats, if there are more unread chats that were not fetched, this flag is true |
» chats | [Chat] | true | none | none |
»»» tags | [ContactTag] | true | none | Tags associated with this contact |
»»» assignee | string¦null | false | none | The assignee of the contact |
»»» assigner | string¦null | false | none | The person who assigned this contact |
»»» messagesSent | number | true | none | none |
»»» messagesReceived | number | true | none | none |
»»» chat | object | false | none | none |
»» messages | [allOf] | false | none | none |
allOf
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
»»»»» randomizeMessage | boolean | false | none | Adds random whitespace to produce a distinct message |
»»»»» buttonReplyId | string | false | none | the ID of the button clicked |
»»»»» pollReplyOptions | [string] | false | none | the option of the poll that was clicked |
»»»»» cancelIfReplyReceived | boolean | false | none | If true, the message will be cancelled if a reply is received |
and
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
»»»» deleted | boolean | false | none | True, if the message was deleted |
»»»» action | object¦null | false | none | none |
»»»»» type | string | true | none | none |
»»»»» parameters | [string] | false | none | none |
»»»» attachments | [MessageAttachment] | false | none | none |
»»»» buttons | [MessageButton]¦null | false | none | none |
»»»» products | [MessageProduct]¦null | false | none | none |
»»»» order | object¦null | false | none | none |
»»»»» orderId | string | true | none | none |
»»»»» jpegThumbnail | string(base64) | false | none | none |
»»»»» itemCount | integer | false | none | none |
»»»»» sellerId | string | true | none | none |
»»»»» token | string | true | none | none |
continued
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
»» presences | [ChatPresence] | false | none | none |
»» cursor | string | true | none | cursor to sort chats by |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: CHATS_ACCESS_ALL CHATS_ACCESS_ASSIGNED )
Code samples
PATCH /chats/{accountId}/{id}
Update a chat — read, unread, archive, pin etc.
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
id | path | ContactID | true | none |
body | body | ChatAction | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Chat |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: CHATS_ACCESS_ALL CHATS_ACCESS_ASSIGNED )
Code samples
POST /chats/{accountId}/{id}/presence
Update a chat’s presence.
Note: Sending an “available” presence, will also subscribe you to events from the other party
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
presence | query | PresenceType | true | none |
accountId | path | string | true | none |
id | path | ContactID | true | none |
PARAMETER | VALUE |
---|---|
presence | available |
presence | unavailable |
presence | typing |
presence | stoppedTyping |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: CHATS_ACCESS_ASSIGNED CHATS_ACCESS_ALL )
Chat History
Code samples
GET /chat-history
Fetch chat history as a file
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
timeZone | query | string | false | none |
chatId | query | array[string] | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» requestId | string | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: CHATS_ACCESS_ALL )
Code samples
GET /chat-history/{requestId}
Poll route to see if file is done
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
requestId | path | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» url | string | false | none | none |
» status | string | false | none | none |
PROPERTY | VALUE |
---|---|
status | success |
status | executing |
status | error |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: CHATS_ACCESS_ALL )
Contacts
Code samples
GET /contacts/{accountId}/{id}/image
Get the display image of a contact
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
id | path | string | true | none |
accountId | path | string | true | none |
type | query | string | false | Whether to fetch preview sized image or the full image |
PARAMETER | VALUE |
---|---|
type | preview |
type | full |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» url | string¦null | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai
Code samples
GET /contacts
Get contacts
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
returnTotalCount | query | boolean | false | none |
returnLastMessage | query | boolean | false | none |
page | query | string | false | none |
count | query | object | false | none |
tags | query | array[string] | false | Get contacts who fall in either of these tags |
notTags | query | array[string] | false | Get contacts who are not in any of these tags |
contacts | query | array[string] | false | Get these specific contact ids |
notContacts | query | array[string] | false | Do not get these specific contacts |
minMessagesSent | query | integer | false | Minimum messages sent |
minMessagesRecv | query | integer | false | Minimum messages received |
maxMessagesSent | query | integer | false | Maximum messages sent |
maxMessagesRecv | query | integer | false | Maximum messages received |
q | query | string | false | Search string for contact name/phone number/email |
assignee | query | array[string] | false | Get contacts assigned to the specified users |
notAssignee | query | array[string] | false | Exclude contacts assigned to the specified users |
accountId | query | array[string] | false | Get contacts only belonging to this account |
type | query | string | false | only get contacts of type |
PARAMETER | VALUE |
---|---|
type | group |
type | individual |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» totalCount | number | false | none | total contacts present with these filters. Only returned if returnTotalCount is true |
» contacts | [Contact] | true | none | none |
»» tags | [ContactTag] | true | none | Tags associated with this contact |
»» assignee | string¦null | false | none | The assignee of the contact |
»» assigner | string¦null | false | none | The person who assigned this contact |
»» messagesSent | number | true | none | none |
»» messagesReceived | number | true | none | none |
»» chat | object | false | none | none |
» nextPage | string¦null | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: CONTACTS_READ_ALL CONTACTS_READ_ASSIGNED )
Code samples
PATCH /contacts
Update contacts
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
messageContainsText | query | string | false | none |
messageFrom | query | Timestamp | false | none |
messageTo | query | Timestamp | false | none |
messageFromMe | query | boolean | false | none |
body | body | ContactsPatch | false | none |
tags | query | array[string] | false | Get contacts who fall in either of these tags |
notTags | query | array[string] | false | Get contacts who are not in any of these tags |
contacts | query | array[string] | false | Get these specific contact ids |
notContacts | query | array[string] | false | Do not get these specific contacts |
minMessagesSent | query | integer | false | Minimum messages sent |
minMessagesRecv | query | integer | false | Minimum messages received |
maxMessagesSent | query | integer | false | Maximum messages sent |
maxMessagesRecv | query | integer | false | Maximum messages received |
q | query | string | false | Search string for contact name/phone number/email |
assignee | query | array[string] | false | Get contacts assigned to the specified users |
notAssignee | query | array[string] | false | Exclude contacts assigned to the specified users |
accountId | query | array[string] | false | Get contacts only belonging to this account |
type | query | string | false | only get contacts of type |
PARAMETER | VALUE |
---|---|
type | group |
type | individual |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» updated | number | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai( Scopes: CONTACTS_UPDATE )
Code samples
DELETE /contacts
Delete contacts
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
tags | query | array[string] | false | Get contacts who fall in either of these tags |
notTags | query | array[string] | false | Get contacts who are not in any of these tags |
contacts | query | array[string] | false | Get these specific contact ids |
notContacts | query | array[string] | false | Do not get these specific contacts |
minMessagesSent | query | integer | false | Minimum messages sent |
minMessagesRecv | query | integer | false | Minimum messages received |
maxMessagesSent | query | integer | false | Maximum messages sent |
maxMessagesRecv | query | integer | false | Maximum messages received |
q | query | string | false | Search string for contact name/phone number/email |
assignee | query | array[string] | false | Get contacts assigned to the specified users |
notAssignee | query | array[string] | false | Exclude contacts assigned to the specified users |
accountId | query | array[string] | false | Get contacts only belonging to this account |
type | query | string | false | only get contacts of type |
PARAMETER | VALUE |
---|---|
type | group |
type | individual |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: CONTACTS_DELETE )
Code samples
POST /contacts/upsert
Create contacts
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | ContactsPost | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: CONTACTS_CREATE )
Code samples
GET /contacts/exists
Check a given user exists on the IM platform
Eg. provide a phone number to check whether the user is registered on WhatsApp
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
type | query | string | true | which account type to check from |
phoneNumber | query | string | false | check for the given phone number |
PARAMETER | VALUE |
---|---|
type |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» exists | boolean | true | none | Whether the user exists |
» id | string | true | none | True ID of the user on the platform |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: CONTACTS_READ_ALL )
Messages
Code samples
PATCH /messages/{status}/retry
Retry all the messages in a given status
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | object | false | none |
status | path | string | true | none |
PARAMETER | VALUE |
---|---|
status | pending |
status | error |
status | cancelled |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: MESSAGES_SEND_TO_ASSIGNED )
Code samples
DELETE /messages/{status}/retry
Clears all pending/error messages
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | query | string | false | If specified, only clears messages of this account |
chatId | query | ContactID | false | If specified, only clears messages of this chat |
status | path | string | true | none |
PARAMETER | VALUE |
---|---|
status | pending |
status | error |
status | cancelled |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: MESSAGES_DELETE )
Code samples
GET /messages/{accountId}/{chatId}
Fetch messages of the chat
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
chatId | path | ContactID | true | none |
beforeId | query | string | false | Get messages before this message ID |
count | query | number | false | Number of messages to fetch |
forceReload | query | boolean | false | Deletes all cached messages for this chat & fetches messages again from the original API source |
status | query | string | false | fetch only “notes”, “pending” or “error” messages |
fromMe | query | boolean | false | fetch only messages sent by me/or the other party |
attachmentType | query | array[string] | false | Fetch only messages with attachments of this type |
includeCursorMessage | query | boolean | false | should include cursor message in the response |
PARAMETER | VALUE |
---|---|
status | note |
status | pending |
status | error |
attachmentType | image |
attachmentType | video |
attachmentType | contact |
attachmentType | sticker |
attachmentType | audio |
attachmentType | document |
attachmentType | location |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» nextPage | string | false | none | none |
» messages | [allOf] | true | none | none |
allOf
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
»»»» randomizeMessage | boolean | false | none | Adds random whitespace to produce a distinct message |
»»»» buttonReplyId | string | false | none | the ID of the button clicked |
»»»» pollReplyOptions | [string] | false | none | the option of the poll that was clicked |
»»»» cancelIfReplyReceived | boolean | false | none | If true, the message will be cancelled if a reply is received |
and
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
»»» deleted | boolean | false | none | True, if the message was deleted |
»»» action | object¦null | false | none | none |
»»»» type | string | true | none | none |
»»»» parameters | [string] | false | none | none |
»»» attachments | [MessageAttachment] | false | none | none |
»»» buttons | [MessageButton]¦null | false | none | none |
»»» products | [MessageProduct]¦null | false | none | none |
»»» order | object¦null | false | none | none |
»»»» orderId | string | true | none | none |
»»»» jpegThumbnail | string(base64) | false | none | none |
»»»» itemCount | integer | false | none | none |
»»»» sellerId | string | true | none | none |
»»»» token | string | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai
Code samples
POST /messages/{accountId}/{chatId}
Send a message
Send a message with text and/or attachments. The text
property can be used as a mustache template which automatically prefills data from the contact’s details including custom fields. Some examples:
{"text": "Hello there {{name}}"}
will automatically pre-fill the contact’s name (if present){"text": "Hello {{name}} your number is {{phoneNumber}}"}
will automatically pre-fill the contact’s name & phone number{"text": "Hello {{name}} your pet name is {{pet name}}"}
will automatically pre-fillpetName
if the contact has such a custom field
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | The account to use to send the message. |
chatId | path | ContactID | true | The contact to send the message to. |
requireOpenAccount | query | boolean | false | Only sends the message if the account is open, returns 428 otherwise |
useRandomAccountIfAccountClosed | query | boolean | false | Use random account (if available) to send the message, if the account specified is closed |
includeMarketingMessage | query | boolean | false | Includes the default marketing message for the account in the message |
body | body | MessageCompose | false | none |
accountId: The account to use to send the message. Pass as the literal “random” to use a random account
chatId: The contact to send the message to.
To send to a phone number, supply the phone number with country code and no spaces. Eg. 601234534211
, [email protected]
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | [allOf] | false | none | none |
allOf
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
»»» randomizeMessage | boolean | false | none | Adds random whitespace to produce a distinct message |
»»» buttonReplyId | string | false | none | the ID of the button clicked |
»»» pollReplyOptions | [string] | false | none | the option of the poll that was clicked |
»»» cancelIfReplyReceived | boolean | false | none | If true, the message will be cancelled if a reply is received |
and
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
»» deleted | boolean | false | none | True, if the message was deleted |
»» action | object¦null | false | none | none |
»»» type | string | true | none | none |
»»» parameters | [string] | false | none | none |
»» attachments | [MessageAttachment] | false | none | none |
»» buttons | [MessageButton]¦null | false | none | none |
»» products | [MessageProduct]¦null | false | none | none |
»» order | object¦null | false | none | none |
»»» orderId | string | true | none | none |
»»» jpegThumbnail | string(base64) | false | none | none |
»»» itemCount | integer | false | none | none |
»»» sellerId | string | true | none | none |
»»» token | string | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: MESSAGES_SEND_TO_ALL MESSAGES_SEND_TO_ASSIGNED )
Code samples
GET /messages/search
Search messages
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | query | array[string] | false | Get contacts only belonging to this account |
q | query | string | true | none |
chatId | query | ContactID | false | none |
page | query | number | false | Page number |
count | query | number | false | Number of messages to fetch |
returnChats | query | boolean | false | Return the corresponding chats alongside the messages |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» nextPage | number | false | none | none |
» messages | [allOf] | true | none | none |
allOf
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
»»»» randomizeMessage | boolean | false | none | Adds random whitespace to produce a distinct message |
»»»» buttonReplyId | string | false | none | the ID of the button clicked |
»»»» pollReplyOptions | [string] | false | none | the option of the poll that was clicked |
»»»» cancelIfReplyReceived | boolean | false | none | If true, the message will be cancelled if a reply is received |
and
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
»»» deleted | boolean | false | none | True, if the message was deleted |
»»» action | object¦null | false | none | none |
»»»» type | string | true | none | none |
»»»» parameters | [string] | false | none | none |
»»» attachments | [MessageAttachment] | false | none | none |
»»» buttons | [MessageButton]¦null | false | none | none |
»»» products | [MessageProduct]¦null | false | none | none |
»»» order | object¦null | false | none | none |
»»»» orderId | string | true | none | none |
»»»» jpegThumbnail | string(base64) | false | none | none |
»»»» itemCount | integer | false | none | none |
»»»» sellerId | string | true | none | none |
»»»» token | string | true | none | none |
continued
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» chats | [Chat] | false | none | none |
»»» tags | [ContactTag] | true | none | Tags associated with this contact |
»»» assignee | string¦null | false | none | The assignee of the contact |
»»» assigner | string¦null | false | none | The person who assigned this contact |
»»» messagesSent | number | true | none | none |
»»» messagesReceived | number | true | none | none |
»»» chat | object | false | none | none |
»» messages | [allOf] | false | none | none |
»» cursor | string | true | none | cursor to sort chats by |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai
Code samples
PATCH /messages/{accountId}/{chatId}/{id}
Modify a message/note
Can reschedule a message, update the content of a note or mark it as resolved
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | object | false | none |
» resolved | body | boolean | false | none |
» text | body | string | false | none |
» attachments | body | [MessageAttachment] | false | none |
» mentions | body | [ContactID] | false | [ID for the contact/chat on the platform] |
accountId | path | string | true | none |
chatId | path | ContactID | true | none |
id | path | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Message |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai
Code samples
DELETE /messages/{accountId}/{chatId}/{id}
Delete a message
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
chatId | path | ContactID | true | none |
id | path | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: MESSAGES_DELETE )
Code samples
POST /messages/{accountId}/{chatId}/{id}/forward
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
chatId | path | ContactID | true | none |
id | path | string | true | none |
toChatId | query | array[string] | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | [allOf] | false | none | none |
allOf
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
»»» randomizeMessage | boolean | false | none | Adds random whitespace to produce a distinct message |
»»» buttonReplyId | string | false | none | the ID of the button clicked |
»»» pollReplyOptions | [string] | false | none | the option of the poll that was clicked |
»»» cancelIfReplyReceived | boolean | false | none | If true, the message will be cancelled if a reply is received |
and
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
»» deleted | boolean | false | none | True, if the message was deleted |
»» action | object¦null | false | none | none |
»»» type | string | true | none | none |
»»» parameters | [string] | false | none | none |
»» attachments | [MessageAttachment] | false | none | none |
»» buttons | [MessageButton]¦null | false | none | none |
»» products | [MessageProduct]¦null | false | none | none |
»» order | object¦null | false | none | none |
»»» orderId | string | true | none | none |
»»» jpegThumbnail | string(base64) | false | none | none |
»»» itemCount | integer | false | none | none |
»»» sellerId | string | true | none | none |
»»» token | string | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: MESSAGES_SEND_TO_ALL )
Code samples
POST /messages/{accountId}/{chatId}/{id}/refresh
refresh a message, in case the media expired
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
chatId | path | ContactID | true | none |
id | path | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Message |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai
Groups
Code samples
GET /groups/{accountId}/{id}
Get metadata for a group
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
id | path | string | true | none |
forceRefresh | query | boolean | false | Fetches the group metadata again from the platform |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | GroupMetadata |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: CHATS_ACCESS_ALL CHATS_ACCESS_ASSIGNED )
Code samples
PATCH /groups/{accountId}/{id}
Update a group
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
id | path | string | true | none |
body | body | GroupAction | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | GroupMetadata |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: GROUPS_UPDATE )
Code samples
GET /groups/{accountId}/{id}/invite-code
Get invite code for a group
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
id | path | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» inviteCode | string | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: CHATS_ACCESS_ALL CHATS_ACCESS_ASSIGNED )
Code samples
POST /groups/{accountId}
Create a new group
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
body | body | GroupCreate | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | GroupMetadata |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: GROUPS_CREATE )
Code samples
POST /groups/{accountId}/{id}/join
Join a group using invite code
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
id | path | string | true | none |
code | query | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | GroupMetadata |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: GROUPS_UPDATE )
Code samples
POST /groups/{accountId}/{id}/leave
Leave a group
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | string | true | none |
id | path | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» additionalProperties | any | false | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: GROUPS_UPDATE )
Tags
Code samples
GET /tags
Get all the tags
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» tags | [Tag] | true | none | none |
oneOf
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|
xor
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: TAGS_READ )
Code samples
DELETE /tags
Delete a tag
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
name | query | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: TAGS_DELETE )
Code samples
POST /tags
Create a tag
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
tags | query | array[string] | false | Get contacts who fall in either of these tags |
notTags | query | array[string] | false | Get contacts who are not in any of these tags |
contacts | query | array[string] | false | Get these specific contact ids |
notContacts | query | array[string] | false | Do not get these specific contacts |
minMessagesSent | query | integer | false | Minimum messages sent |
minMessagesRecv | query | integer | false | Minimum messages received |
maxMessagesSent | query | integer | false | Maximum messages sent |
maxMessagesRecv | query | integer | false | Maximum messages received |
q | query | string | false | Search string for contact name/phone number/email |
assignee | query | array[string] | false | Get contacts assigned to the specified users |
accountId | query | array[string] | false | Get contacts only belonging to this account |
type | query | string | false | only get contacts of type |
name | query | string | true | none |
PARAMETER | VALUE |
---|---|
type | group |
type | individual |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Tag |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: TAGS_CREATE )
Code samples
PATCH /tags
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
name | query | string | true | none |
body | body | object | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Tag |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: TAGS_CREATE )
Files
Code samples
POST /files
Upload a file to the media files bucket
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
mimetype | query | string | true | none |
name | query | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» additionalProperties | any | false | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai
Templates
Code samples
POST /templates/{accountId}/submit-for-review
Submit a template for review
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | AccountID | true | none |
body | body | object | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» id | string | true | none | ID of the template submitted for review |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: TEMPLATES_CREATE )
Code samples
DELETE /templates/{accountId}/{templateId}
Delete a template on the platform
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | AccountID | true | none |
templateId | path | string | true | none |
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | None |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: TEMPLATES_CREATE )
Product
Code samples
GET /{accountId}/{orderId}/order-details
Fetch details of an order (likely from an order message)
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | AccountID | true | none |
orderId | path | string | true | none |
token | query | string | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | OrderDetails |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai
Code samples
GET /products
Get the products from WA catalog.
Returns the WA catalog. Only available on WA Business apps.
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | query | array[string] | false | none |
teamId | query | string | true | none |
q | query | string | false | Filter if product title/description contains this |
category | query | string | false | Filter based on collection/category |
notCategory | query | string | false | Returns products not belonging to the specified category |
id | query | array[string] | false | none |
cursor | query | string | false | none |
count | query | integer | false | none |
returnTotalCount | query | boolean | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» totalCount | number | false | none | total products present with these filters. Only returned if returnTotalCount is true |
» products | [PlatformProduct] | true | none | [Model for a product on an external platform (eg. WhatsApp)] |
»» description | string | true | none | none |
»» price | integer¦null | true | none | none |
»» currency | string¦null | true | none | none |
»» isHidden | boolean | true | none | none |
»» id | string | true | none | none |
» nextPage | string | false | none | none |
This operation does not require authentication
Code samples
POST /products
Upsert products to the WA catalog
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | query | AccountID | true | none |
body | body | object | false | none |
» products | body | [PlatformProductCreate] | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» products | [PlatformProduct] | true | none | [Model for a product on an external platform (eg. WhatsApp)] |
»» description | string | true | none | none |
»» price | integer¦null | true | none | none |
»» currency | string¦null | true | none | none |
»» isHidden | boolean | true | none | none |
»» id | string | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: PRODUCTS_CREATE )
Code samples
PATCH /products/{accountId}
Update products by the given filter in the WA catalog
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
body | body | PlatformProductUpdate | false | none |
accountId | path | AccountID | true | none |
id | query | array[string] | false | none |
notId | query | array[string] | false | none |
q | query | string | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» products | [PlatformProduct] | true | none | [Model for a product on an external platform (eg. WhatsApp)] |
»» description | string | true | none | none |
»» price | integer¦null | true | none | none |
»» currency | string¦null | true | none | none |
»» isHidden | boolean | true | none | none |
»» id | string | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: PRODUCTS_UPDATE )
Code samples
DELETE /products/{accountId}
Delete products by the given filter from the catalog
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | AccountID | true | none |
id | query | array[string] | false | none |
notId | query | array[string] | false | none |
q | query | string | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: PRODUCTS_DELETE )
Code samples
POST /products/sync
Trigger sync of the specified products on twowayai with WhatsApp
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | query | AccountID | true | Account ID to sync products from/to |
id | query | array[string] | false | Products to sync with WhatsApp. Leave unspecified to trigger all |
syncForward | query | boolean | false | Sync products from twowayai to WhatsApp |
syncBackward | query | boolean | false | Sync missing products from WhatsApp to twowayai |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: PRODUCTS_UPDATE )
Alibaba Cams
Code samples
GET /alibaba-cams/metadata
Query metadata for Alibaba CAMS API
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» appId | string | true | none | Meta app ID for embedded sign up |
» isvTermsTemplate | string | true | none | Meta terms pdf template for embedded sign up |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai
Code samples
POST /alibaba-cams/register/{accountId}
Register an account with a token from embedded sign up
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | AccountID | true | none |
body | body | object | false | none |
» token | body | string | true | Token from embedded sign up |
» selectedPhoneNumber | body | string | false | Phone number to connect to the account. No formatting, just digits with country code. If not provided, the first phone number will be used. |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» userId | string | true | none | User ID for the account |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: ACCOUNT_PATCH )
Code samples
POST /alibaba-cams/isv-terms/{accountId}
Submit ISV terms to Alibaba CAMS API
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | AccountID | true | none |
body | body | AlibabaCAMSISVTerms | false | none |
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | None |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: ACCOUNT_PATCH )
Code samples
PATCH /alibaba-cams/profile/{accountId}
Update business info for Alibaba CAMS API
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | AccountID | true | none |
body | body | object | false | none |
» profilePictureUrl | body | string | false | Business profile picture URL |
» description | body | string | false | Business description |
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | None |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: ACCOUNT_PATCH )
Code samples
POST /webhook/{accountId}/{secret}/alibaba-cams
Receive a message from Alibaba CAMS API
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | AccountID | true | none |
secret | path | AccountSecret | true | none |
body | body | AlibabaCAMSWebhookRequest | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
This operation does not require authentication
Product Categories
Code samples
GET /product-categories
Get the categories (collections) from WA catalog.
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | query | AccountID | false | none |
teamId | query | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» categories | [ProductCategory] | true | none | none |
This operation does not require authentication
Code samples
POST /product-categories/{accountId}
Add a new product category
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | AccountID | true | none |
body | body | object | false | none |
» name | body | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | ProductCategory |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: PRODUCTS_CREATE )
Code samples
PATCH /product-categories/{accountId}/{categoryId}
Update a category
Update name of the category or add/remove a product
Body parameter
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | AccountID | true | none |
categoryId | path | string | true | none |
body | body | ProductCategoryPatchRequest | false | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: PRODUCTS_UPDATE )
Code samples
DELETE /product-categories/{accountId}/{categoryId}
Delete a category
NAME | IN | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|---|
accountId | path | AccountID | true | none |
categoryId | path | string | true | none |
Example responses
200 Response
STATUS | MEANING | DESCRIPTION | SCHEMA |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
» success | boolean | true | none | none |
To perform this operation, you must be authenticated by means of one of the following methods: twowayai ( Scopes: PRODUCTS_DELETE )
Schemas
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
statusCode | number | true | none | none |
error | string | true | none | Specific description of the error |
message | string | true | none | What the error was |
data | object | false | none | Some extra information about the error |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string | false | none | none |
PROPERTY | VALUE |
---|---|
anonymous | wa |
anonymous | wa-business-api |
anonymous | mock |
anonymous | tiktok |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string | false | none | none |
PROPERTY | VALUE |
---|---|
anonymous | available |
anonymous | unavailable |
anonymous | typing |
anonymous | stoppedTyping |
Describes the current state of an account. 1. open => logged in & connected to WhatsApp. Can send & receive messages now 2. connecting => establishing connection to WhatsApp. QR code is available during this state 3. close => connection to WhatsApp is closed, account is inactive at the moment
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string | false | none | Describes the current state of an account. 1. open => logged in & connected to WhatsApp. Can send & receive messages now 2. connecting => establishing connection to WhatsApp. QR code is available during this state 3. close => connection to WhatsApp is closed, account is inactive at the moment |
PROPERTY | VALUE |
---|---|
anonymous | open |
anonymous | connecting |
anonymous | close |
Assignees who can access this account.
None
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
notifyUsers | [string] | false | none | Supply a list of user IDs to notify when a new message arrives |
enableHistorySync | boolean | false | none | Should chat history be synced with the database |
maxMessageSync | integer | false | none | Maximum number of messages that would be synced to the database |
nativeChatActionSync | boolean | false | none | Will doing a chat action (like archive, mark unread) actually sync it back with the primary device |
newChatsAssignee | object | false | none | All new chats will be auto asssigned if one of the option is enabled and select any Assignee |
sendButtonsAsPoll | boolean | false | none | Should polls be sent as buttons instead of a message. This is useful for the regular WhatsApp API |
autoSyncProductsToPlatform | boolean | false | none | Should products be synced to WhatsApp automatically. |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
enabled | boolean | false | none | This flag will define if option should enabled/disabled |
assignees | [string] | false | none | Auto assigned will work for the selected teammates |
Update an account. Specifying account updates the type
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
nickname | string | false | none | none |
oneOf
xor
xor
continued
Update a product category
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
name | string | false | none | New name of the category |
products | [object] | false | none | none |
» productId | string | true | none | none |
» type | string | true | none | none |
PROPERTY | VALUE |
---|---|
type | add |
type | remove |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
type | string | true | none | none |
initialAccessToken | string | false | none | The initial access token used to authenticate with Alibaba CAMS service |
wabaId | string | false | none | The WABA ID of the business account. This is the same as the business account’s JID |
templateNamespace | string | false | none | none |
custSpaceId | string | false | none | The customer space ID of the business account. Used internally |
secret | string | true | none | Secret for WebHook |
PROPERTY | VALUE |
---|---|
type | alibaba-cams-v2 |
oneOf
xor
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
type | string | true | none | none |
cookies | object | true | none | Cookies for TikTok. This must be a serialised tough-cookie cookiejar |
» additionalProperties | any | false | none | none |
PROPERTY | VALUE |
---|---|
type | tiktok |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string | false | none | none |
PROPERTY | VALUE |
---|---|
anonymous | individual |
anonymous | group |
anonymous | broadcast |
anonymous | post |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string | false | none | none |
PROPERTY | VALUE |
---|---|
anonymous | error |
anonymous | pending |
anonymous | note |
anonymous | sent |
anonymous | delivered |
anonymous | read |
anonymous | cancelled |
None
None
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
patch | object | true | none | none |
» name | string | false | none | none |
» phoneNumber | string | false | none | none |
string | false | none | none | |
» assignee | string¦null | false | none | none |
» tags | [ContactTag] | false | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
name | string | true | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
tags | [ContactTag] | true | none | Tags associated with this contact |
None
None
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
originalId | string | false | none | Original ID from the provider |
templateId | string | false | none | WA Business template |
templateParams | object | false | none | WA Business template params — do not need to populate |
» additionalProperties | string | false | none | none |
withTyping | boolean | false | none | Emulate typing behaviour before send |
forwardCount | number | false | none | none |
forwarded | object | false | none | the message being forwarded |
randomizeMessage | boolean | false | none | Adds random whitespace to produce a distinct message |
buttonReplyId | string | false | none | the ID of the button clicked |
pollReplyOptions | [string] | false | none | the option of the poll that was clicked |
cancelIfReplyReceived | boolean | false | none | If true, the message will be cancelled if a reply is received |
allOf
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | object | false | none | none |
and
None
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
total1000 | integer | false | none | actual price * 1000 |
subtotal1000 | integer | false | none | none |
currency | string | true | none | none |
None
allOf
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | object | false | none | none |
» id | string | false | none | Specify the message Id — can be used to atomically send messages. Two messages with the same ID will never be sent twice |
» status | string | false | none | Set the status of the message, use to create notes |
and
PROPERTY | VALUE |
---|---|
status | note |
status | pending |
None
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
currencyCode | string | true | none | 3-letter ISO currency code |
price1000 | integer | true | none | the actual price * 1000 |
title | string | true | none | none |
description | string | false | none | none |
url | string | false | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
id | string | true | none | none |
accountId | string | false | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
amount | integer | true | none | none |
currency | string | true | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
jpegThumbnail | string(base64) | false | none | none |
title | string | true | none | none |
description | string | true | none | none |
url | string(uri) | true | none | none |
matchedText | string | false | none | none |
Describes a reaction on a message
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
anonymous | string | false | none | Describes a reaction on a message |
None
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
mentions | [string] | false | none | none |
text | string¦null | true | none | none |
NAME | TYPE | REQUIRED | RESTRICTIONS | DESCRIPTION |
---|---|---|---|---|
options | [PollOption] | true |