For the complete documentation index, see llms.txt. This page is also available as Markdown.

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)

    1. Firstly, you will need to disable the AI builder.

    2. To disable AI builder, you can delete all nodes from these playbooks - Default, Fallback and Transfer. In each of the playbooks, add a End node at the start.

    3. 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

Field
Value

Content-Type*

application/json

Body

Field
Type
Description

id

string

Unique message id

phone

string

Phone no. in E164 Format starting + with country code and phone number without any space or other chars

reply_to

string

Id of the message replied to (if user replied to a particular message)

msg_time

number

Time in milli-seconds

messageBy

string

Fixed value USER

name

string

Name of user set in QuickReply

email

string

Email of user if set in QuickReply

Payload Object

Field
Type
Description

_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

Field
Type
Description

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

Field
Type
Description

header

Object

Header Object Fields

For replies to messages containing media such as videos, images, documents, or audio:

  1. type: Specifies the type of header (e.g., image, video, document).

  2. 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

Param
Type
Description

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

Text message sent by user
Image message having a caption
Image message without any caption
Document with caption
Video with caption
Reply to a text message with a text message
Reply to a text message with an Image having caption
Quick Reply button click (Selecting button on message having QuickReply buttons)
Text message having a URL

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

Field
Type
Value
Description

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

Param
Type
Value
Description

to*

string

<phone_number>

Phone no. in E164 Format

payload*

JSON object

<payload object>

Payload object is explained below

Payload

Field
Type
Required for
Description

_type

string

All messages

Use AGENT_TEXT for text and media, AGENT_TRIGGER_QUESTION for quick replies, WA_LIST for list messages, or AGENT_LOCATION for locations.

text

string

Text, image, document, video, quick reply, and list

Message text or media caption. It is not used for audio or location messages.

img

URL

Image

Public image URL. Maximum size: 5 MB.

video

URL

Video

Public video URL. Maximum size: 16 MB.

audio

URL

Audio

Public audio URL. Maximum size: 16 MB. Audio messages have no caption.

document

object

Document

Provide link as a public URL and filename as the displayed filename. Maximum size: 16 MB.

options

array

Quick reply

Up to three objects, each with a text field.

title

string

List

List message header.

list_title

string

List

Label for the list button.

sections

array

List

Sections with section_name and options. Each option contains text and an optional description.

name, address

string

Location

Location name and address.

latitude, longitude

number

Location

Location coordinates.

Supply only one media field: img, video, audio, or document.

Examples

All examples use the same endpoint and authentication headers.

Plain text
Image with caption
Document with caption
Quick reply buttons
List message
Location
Video with caption
Audio

Response

Response is a JSON object with the following structure

Field
Type
Description

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

Response is a JSON object with the following structure

Param
Type
Value

error

string

error message

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

Field
Type
Description

id

string

unique message id

event

string

one of SENT DELIVERED READ

phone

string

Phone no. in E164 Format starting + with country code and phone number without any space or other chars

name

string

Name of user set in QuickReply

email

string

Email of user if set in QuickReply

messageBy

string

one of AUTOMATION or AGENT

agentId

string

When messageBy is AGENT, it contains agent who sent message

automationBy

string

When messageBy is AUTOMATION, it contains what automation triggered this message. It will be one of BROADCAST CAMPAIGN JOURNEY API_TEMPLATE CHAT_BOT

broadcastId

string

if automationBy is BROADCAST it contains broadcast id

campaignId

string

if automationBy is CAMPAIGN it contains campaign id

journeyId

string

if automationBy is JOURNEY it contains journey id

templateId

string

if it is template message, it contains template id


Important Notes

  • If you want your system to generate responses to incoming messages, you can ignore message events for messages not sent by you via API.

  • If you are using GenAI/LLM to generate responses, you might need message history that you have to maintain on your own.

How to Configure Webhooks?

To configure Webhooks, Send the URL you would like to configure to help@quickreply.ai and our support team will assist you.

Last updated