Summary
If you're using Wati's Multiple WhatsApp Numbers feature, this guide explains how to use Wati’s API across different connected numbers.
Instructions
Using multiple WhatsApp numbers in your Wati account lets you send and receive messages from different numbers. To make sure your API calls go through the correct number, you need to include an extra key in the payload or URL depending on the API you're using.
Below are the APIs that support multiple numbers presently and how to use them.
1. Send template message API
Endpoint:POST /{tenantId}/api/v1/sendTemplateMessage
Required fields:
Tenant ID
WhatsApp Number
channelNumber (in the payload): The phone number you want to send the message from.
For example, if you want the message to be sent from your default number, set channelNumber
to that default phone number.
2. Update chat status API
Endpoint:POST /{tenantId}/api/v1/updateChatStatus
Required fields:
Tenant ID
channelPhoneNumber (in the payload): Set this to the number whose chat status you want to update.
The chat status will get updated for the Phone number submitted as value for “channelPhoneNumber”.
3. Get messages by WhatsApp number API
Endpoint:GET /{tenantId}/api/v1/getMessages/{whatsappNumber}
Here as shown below the query parameters Whatsapp Number and Tenant ID are required and to get the message from which number connected, need to specify as a query parameter
For example, to fetch messages from your default number, provide that number as value for channelPhoneNumber
.
4. Send message to opened session
Endpoint: Post /{tenantId}/api/v1/sendSessionMessage/{whatsappNumber}
As shown below the parameter “Tenant ID” , “Whatsapp Number” & ‘Message Text” is required, and in the payload need to specify the “channelPhoneNumber”.
For example: To send a session message from Default Number. Specify the Default number as value for “channelPhoneNumber” in payload
5. Other APIs that work without specifying the number
The following APIs do not require a specific phone number to be set because contact data is shared across all connected numbers:
Add Contact:
POST /{tenantId}/api/v1/addContact/{whatsappNumber}
Update Contact Attributes:
POST /{tenantId}/api/v1/updateContactAttributes/{whatsappNumber}
Update Contact Attributes List:
Get Contact List:
Note: You can find your Access Token and API endpoint details by going to the API Docs page in your Wati environment.
Wati APIs and their support for Multiple WhatsApp Numbers
API Name | Available |
Send template message | Yes |
Send template messages | Yes |
Get Messages by WhatsApp number | Yes |
Get Contacts List | Yes |
Update Contact Attributes | Yes |
Update Contact Attributes List | Yes |
Add Contact | Yes |
Send Message to opened session | Yes |
Update Chat Status | Yes |