WhatsApp Chat API
This section explains how you can use QuickReply.ai’s APIs to build a chatbot with your end users over WhatsApp.
Overview
QuickReply.ai offers a native AI builder (chatbot builder) that covers most use cases efficiently. For typical needs, this built-in tool provides an easy-to-use and effective solution. The WhatsApp Chat API should be used primarily for scenarios requiring a custom proprietary chatbot with specific functionalities that cannot be achieved with the native builder. This can also be used if you wish to integrate a Generative AI based chatbot on to WhatsApp channel over QuickReply.ai
How It Works
Disable AI Builder (chatbot builder)
Firstly, you will need to disable the AI builder.
To disable AI builder, you can delete all nodes from these playbooks -
Default
,Fallback
andTransfer
. In each of the playbooks, add aEnd
node at the start.Alternatively you can write to help@quickreply.ai get the AI Builder disabled.
Receiving Messages:
Incoming messages from users are received through a webhook configured to handle these events.
Sending Messages:
To send a message to a WhatsApp user, make a POST request to the Send Message endpoint with the required message details.
Handling Message Status Updates:
Track the status of sent messages (e.g., delivered, read) via a webhook that provides real-time updates.
API Endpoints
Receive Message
To receive messages sent by users on your WhatsApp integrated with QuickReply.ai, you will need to configure a webhook url in your QuickReply.ai account.
POST
[Your Webhook URL]
Webhook endpoint for receiving incoming messages from WhatsApp users.
Headers
Content-Type*
application/json
Body
id
string
Unique message id
phone
string
Phone no. in E164 Format
reply_to
string
Id of the message replied to (if user replied to a particular message)
msg_time
number
Time in milli-seconds
payload
JSON Object
Payload Object
_type
string
one of USER_TEXT
,USER_FILE
,USER_LIST_REPLY
or USER_BUTTON_REPLY
text
string
Text sent by user
(in case of USER_TEXT
)
name
string
Name of file
(in case of USER_FILE
)
contentType
string
Content type of file
(in case of USER_FILE
)
caption
string
Text sent by user
(in case of USER_FILE
)
status
string
"SUCCESS"
path
string
URL of the file
(in case of USER_FILE
)
This URL gets expired after an year, so it is recommended to download the file on your server
preview
JSON Object
Preview Object
(in case of reply message or message containing link)
Preview Object
replyPreview
Object
Reply Preview Object (When message is reply to another message)
urlPreview
Object
URL Preview Object (When message contains URL)
If a message has both reply to a message and a url, only the replyPreview will come.
Reply Preview Object
header
Object
Header Object Fields
For replies to messages containing media such as videos, images, documents, or audio:
type: Specifies the type of header (e.g., image, video, document).
previewImage: URL of the preview image, if available.
body
Object
Body Fields:
text: Original text message to which this reply is given.
meta
Object
Metadata
userId: The user ID assigned by QuickReply.ai.
repliedMessageId: Internal message ID used by WhatsApp, typically not needed for user reference.
URL Preview Object
url
string
Complete URL for which preview is included
domain
string
domain of above URL
title
string
title shown to user in the preview
sitename
string
name of website (Currently not shown to user in WhatsApp)
description
string
description shown to user in the preview
image
Object
Image Details
url:
url of Image
width:
width of Image
Height:
height of Image
Sample Payload objects
Send Message
POST
https://app.quickreply.ai/api/whatsapp/send-session-message
Sends a message to a specified WhatsApp user.
You can send message only if user has sent at least one message in the last 24 hours, otherwise message sending will fail.
If you wish to initiate a conversation from your end, you should send Template Message with CTA buttons. If user replies, the session will start and you will be able to send messages.
Headers
client-id*
string
<client id>
You can find client-id of your account in
Settings
> Developers
> API credentials
secret-key*
string
<secret key>
You can find client-id of your account in
Settings
> Developers
> API credentials
Content-Type*
string
application/json
Body
to
*
string
<phone_number>
Phone no. in E164 Format
payload
*
JSON object
<payload object>
Payload object is explained below
payload
_type
*
string
AGENT_TEXT
Currently only text is supported. It doesn’t limit you from sending media using fields below
text
string
<text to send>
Message which is being sent to the user
img
url
URL of image
Image should be publicly accessible via URL. Max 5MB is allowed
video
url
URL of video
Video should be publicly accessible via URL. Max 16MB is allowed
audio
url
URL of audio
Audio should be publicly accessible via URL. Max 16MB is allowed
document
object
{
"link": "<url>",
"filename":"<filename>"
}
url: Document should be publicly accessible via URL. Max 16MB is allowed
filename: Filename to be displayed in WhatsApp
At a time, only one of the img, video, audio or document field can be supplied.
Sending media is optional, and you can send only text as well.
Example -
Response
Response is a JSON object with the following structure
id
string
unique message id if message is sent. null if scheduled
state
string
One of the following
1. SENT
- When message is sent successfully.
2. NOT_SENT
- When an error occurs while sending message. at WhatsApp end
3. SCHEDULED
- When you call campaign API which schedules message to be sent in future instead of sending immediately.
reason
string
When message is not sent, Reason for NOT_SENT
Example
Message Status Update
To receive messages delivery reports you will need to configure a webhook url in your QuickReply.ai account.
POST
[Your Webhook URL]
Webhook endpoint for receiving message status updates from WhatsApp users.
Body
id
string
unique message id
event
string
one of SENT
DELIVERED
READ
How to Configure Webhooks?
To configure Webhooks, write to help@quickreply.ai and our support team will assist you with setting up the webhooks.
Last updated