Introduction
Onextel’s 365cx.io WhatsApp APIs offer robust, secure, and flexible integrations with your system, allowing seamless incorporation of WhatsApp capabilities into your applications. With the Onextel WhatsApp API, you can efficiently send messages, ensuring reliable communication with your users globally.
To start using the API, you will need to generate a token using the Generate token API and pass the same token as authentication for all the send message APIs. This authentication token is valid for one hour and the validity keeps on increasing if it is being used.
1. Generate token API #
Request URL: https://365cx.io/account/enterprise/login
HTTP Method: POST
Parameters | Description |
Indicates the email id used for logging in to the 365cx.io platform. | |
password | Indicates the password used for logging in to the 365cx.io platform. |
longTermToken | Indicates if the authentication token remains valid indefinitely |
Sample Curl Request:
curl --location 'https://365cx.io/account/enterprise/login' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'email=xx \
--data-urlencode 'password=xx
Success Response:
{
"response": {
"uId": 100,
"token": "VFl6Zz6ZMezrz+12+8CqIHRZdtxxxxxxxxxxxxxxxx"
},
"message": {
"code": 0,
"message": "Login success"
},
"status": true
}
Failure Response:
{
"message": {
"code": 1403,
"message": "Login failed! wrong email id and password combination"
},
"status": false
}
Send message APIs #
Mandatory parameters #
Please note that these are mandatory and common parameters for all APIs
Parameters | Description | Mandatory |
authentication-token | Token generated from Generate Token API | Yes |
from | Specifies the sender’s phone number. | Yes |
to | Specifies the recipient’s phone number. | Yes |
journeyId | Represents the unique identifier for the journey associated with the message. | Yes |
templateId | Identifies the specific template for the message. | Yes |
Note – To get journeyId, follow these steps:
1. Log in to the 365cx.io platform.
2. Go to Flow Builder -> Streams and click on the stream.
3. Under Configurations, copy journey id from the webhook URL.
Eg: If webhook URL is https://365cx.io/chatbird/message/66c3054f9xxxxxxx61f5501e/send, journey id is 66c3054f9xxxxxxx61f5501e.
Optional parameters #
Please note that these are optional and common parameters for all APIs
Parameters | Description | Mandatory |
deptId | Represents the department of the given account. | No |
callbackUrl | Indicates the URL used for receiving delivery callbacks (Sent, Delivered, Failed, Read) | No |
metaData | It contains custom tags (tag1, tag2, tag3) that provide additional context or categorization for each message. tag1, tag2, tag3: These are customizable fields where you can specify extrainformation for the particular message. Info! By including these tags while sending a message, you can easily filter messages in the Delivery Report section of the 365cx.io platform based on these tags. This allows for efficient categorization andretrieval of messages according to your specific criteria. | No |
1. Send Message API : Text #
Sample Curl Request :
curl --location 'https://365cx.io/chatbird/api/message/send' \
--header 'authentication-token: xx' \
--header 'Content-Type: application/json' \
--data '{
"from": "xx",
"to": "xx",
"journeyId": "xx",
"message": {
"template": {
"templateId": "xx"
}
},
"deptId": "xx",
"callbackUrl": "xx",
"metaData": {
"tag1": "xx",
"tag2": "xx",
"tag3": "xx"
}
}'
2. Send Message API : Text, Variable, Dynamic header, Buttons #
Sample Curl Request
curl --location 'https://365cx.io/chatbird/api/message/send' \
--header 'authentication-token: xx' \
--header 'Content-Type: application/json' \
--data '{
"from": "xx",
"to": "xx",
"journeyId": "xx",
"message": {
"template": {
"templateId": "xx",
"headerParameterValues": {
"0": "xx"
},
"parameterValues": {
"0": "xx"
},
"buttons": [
{
"type": "xx",
"text": "xx",
"payload": "xx"
},
{
"payload": "xx",
"text": "xx",
"type": "xx"
},
{
"type": "xx",
"text": "xx",
"payload": "xx"
}
]
}
},
"deptId": "xx",
"callbackUrl": "xx",
"metaData": {
"tag1": "xx",
"tag2": "xx",
"tag3": "xx"
}
}'
Parameters | Description | Mandatory |
headerParameterValues | Identifies variable values in Header content | Yes if header is dynamic |
parameterValues | Identifies variable values in Body content | Yes if template have variables |
Buttons | ||
type | Specifies that the button is a “URL” or “Quick_Reply” or “Phone_Number” button. | Yes if template have buttons |
text | Specifies the button text as passed in the template | No |
payload | Payload associated with the URL or Quick Reply or Phone Number button. | Yes if its Dynamic URL |
3. Send Message API : Media #
Sample Curl Request :
{
"from": "xxxxxxxx",
"to": "xxxxxxxx",
"journeyId": "xxxxxxxx",
"message": {
"template": {
"templateId": "xxxxxxxx",
"media": {
"type": "xx",
"url": "xxxxxxxx",
"fileName": "xxxxxxxx"
}
}
},
"deptId": "xx",
"callbackUrl": "xx",
"metaData": {
"tag1": "xx",
"tag2": "xx",
"tag3": "xx"
}
}'
Parameters | Description | Mandatory |
Media | ||
type | Indicates the type of media. It could be 1. IMAGE for image templates 2. DOC for pdf templates 3. VIDEO for video templates | Yes if template have media |
url | Represents the URL of the media file (image, document, or video) to be sent | Yes if template have media |
fileName | Specifies the name of the media file attached. | No |
4.Send Message API : Media, Variable, Buttons #
Sample Curl Request :
curl --location 'https://365cx.io/chatbird/api/message/send' \
--header 'authentication-token: xx \
--header 'Content-Type: application/json' \
--data '{
"from": "xx",
"to": "xx",
"journeyId": "xx",
"message": {
"template": {
"templateId": "xx”
"parameterValues": {
"0": "xx"
},
"media": {
"type": "xx",
"url": "xx",
"fileName": "xx"
},
"buttons": [
{
"type": "xx",
"text": "xx",
"payload": "xx"
},
{
"type": "xx",
"text": "xx",
"payload": "xx"
}
]
}
},
"deptId": "xx",
"callbackUrl": "xx",
"metaData": {
"tag1": "xx",
"tag2": "xx",
"tag3": "xx"
}
}
Parameters | Description | Mandatory |
parameterValues | Identifies variable values in Body content | Yes if template have variables |
Media | ||
type | Indicates the type of media. Enter: could be 1. IMAGE for image templates 2. DOC for pdf templates 3. VIDEO for video templates | Yes if template have media |
url | Represents the URL of the media file (image, document, or video) to be sent | Yes if template have media |
fileName | Specifies the name of the media file attached. | |
Buttons | ||
type | Specifies that the button is a URL or Quick Reply button. | Yes if template have buttons |
text | Specifies the button text as passed in the template | No |
payload | Payload associated with the URL or Quick Reply button. | Yes if its Dynamic URL |
5. Send carousel message API #
Sample Curl Request :
curl --location 'https://365cx.io/chatbird/api/message/send' \
--header 'authentication-token: xx \
--header 'Content-Type: application/json' \
--data '{
"from": "xx",
"to": "xx",
"journeyId": "xx",
"message": {
"template": {
"templateId": "xx",
"cards": [
{
"media": {
"type": "xx",
"url": "xx"
},
"buttons": [
{
"type": "xx",
"payload": "xx"
}
]
},
{
"media": {
"type": "xx",
"url": "xx"
},
"buttons": [
{
"type": "xx",
"payload": "xx"
}
]
},
{
"media": {
"type": "xx",
"url": "xx"
},
"buttons": [
{
"type": "xx",
"payload": "xx"
}
]
}
]
}
}
}'
Parameters | Description |
parameterValues | Identifies variable values in Body content For eg: 0 maps value for variable 1 and 1 maps value for variable 2 |
callbackUrl | Indicates the URL used for receiving callbacks |
Media | |
url | Indicates the URL of the media. |
type | Specifies the type of the media (e.g., IMAGE or VIDEO). |
Buttons | |
type | Specifies that the button is a URL or Quick Reply button. |
payload | Payload associated with the URL or Quick Reply button. |
Response Codes #
Success Response:
{
"message": null,
"code": 100,
"status": true,
"data": {
"id": "669e5778a8f5d50aad723e7c"
}
}
Failure Responses:
Wrong Journey ID
{
"message": "Journey not found",
"code": 101,
"status": false,
"data": null
}
Delivery events #
Sample Payload :
{
"context": {
"id": "xxxxxxxx"
},
"from": "xxxxxxxx",
"to": "xxxxxxxx",
"type": "event",
"event": {
"status": "DELIVERED"
},
"error": {
"code": "0",
"message": "Failed Retry"
},
"conversation": {
"id": "xxxxxxxx",
"type": "marketing",
"billable": true
},
"timestamp": xxxxxxxx
}
Parameters | Description |
context.id | The message ID used to identify which message the event corresponds to. |
from | The sender’s phone number |
to | The recipient’s phone number. |
event.status | The delivery status of the message. Possible values are READ,DELIVERED, SENT, FAILED. |
error | Provides error details if the message delivery fails. |
conversation | Contains details about the conversation, such as the ID, type (e.g., marketing), and indicating whether the message is billable. |
timestamp | The time when the event status has been changed. |
Delivery reports
#
The Delivery Report in the 365cx.io platform provides a comprehensive overview of all messages sent through various channels. This feature also allows users to track the status of each message, including whether it was sent, delivered, read, or failed. The Delivery Report is essential for analyzing communication effectiveness and identifying any issues in message delivery.
Filtering Messages Using Tags
To enhance message tracking and categorization, the 365cx.io platform allows users to filter
messages in the Delivery Report using metadata tags. By including metadata tags in the “Send
Message” API Request payload, you can filter messages in the Delivery Report to view specific
messages sent based on these tags.
To Filter Messages in Delivery Report,
1. Choose the resource type as API, for messages sent through the API.
2. Specify the channel type (e.g., WhatsApp) and channel name used for the messages.
3. Set the desired time range for your message search.
4. Use the tag fields (Message Tag 1, Message Tag 2 and Message Tag 3) to filter
messages. Enter the specific tags (tag1, tag2, tag3) you used in the API request to narrow
down your results.
Live Agent Satisfaction Rating API
Use this API for enabling the live agent Average Rating feature in Converse Reports on 365cx.io platform. Create a live agent flow with API widget for capturing ratings assigned to the agent from end users. #
Request URL: https://365cx.io/whatsapp/chat/feedback
HTTP Method: POST
Headers: Add a new key referring to the table below.
Key | Value |
chatId | Identifies and works as a unique identifier for chats |
customerPhoneNumber | Indicates the end user’s phone number |
rating | Indicates the variable which stores the rating provided by the end user |
Sample Curl Request:
{
“chatId”: “${chatId}”,
“customerPhoneNumber”: “${_sys.phoneNumber}”,
“rating”: ${rating}
}