WhatsApp Business API

This document will show more flexible functionalities regarding Qiscus WhatsApp Business API that chatbot normally want. By using these APIs, you will be able to use more type of messages and control it from your own system. Sessions messages, Template Messages, as well as Interactive messages are supported in this documentations. There is also webhooks settings to enable you receiving more messages and events from WhatsApp (messages and status receipt).

Please note that the recipient should opt-in to receive WhatsApp message in order to avoid block for your number.

Use case for this API :

  • OTP verification during login/signup to your app
  • Tracking order in your app
  • Event notifications or Alerting for any event in your system to the customer.

Before You Start

To begin to use the Qiscus WhatsApp Business API you need to have a Qiscus Omnichannel Chat account. You can easily get a Qiscus Omnichannel Chat account by register to this page.

Important Notes

  • Setting the webhook correctly in order to get any information from WhatsApp. For example there's a case the messages aren't delivered to customer this can be because of 24 hour and others factor might happens.
  • Make sure that you still have enough credit or free sessions to sends the template message. If your credit has run out then you cannot proceed a conversation. You can use our new feature Self Top Up or contact us to top up your credit.
  • Need WABA (WhatsApp Business Account) ID to create template

Get Started

A simple step for send message via WhatsApp Business API that you can follow i.e login, set up webhooks, post a text message, and get webhooks.

Authentication

First, you need to know App ID and Qiscus Secret Key to do authentication in Qiscus Omnichannel Chat. Please follow this page to get your App ID and Qiscus Secret Key.

Settings the Webhooks

When a customer sends you a message, the WhatsApp Business API client will send an HTTP POST request notification to your webhook URL. You need to setup the webhook URL in order to get webhooks from WhatsApp Business API. This webhooks will give you events:

  • New messages from WhatsApp users
  • Information whether your message is failed or success when you send a message
  • Any errors from WhatsApp
  • Message status (sent, delivered, read)

See Errors and Status Messages for more information on any errors you receive.

Your Server is a system server that you will be integrated with WhatsApp Business API.

URL:

HTTP
Copy

Please follow this page to get your App ID, Qiscus Secret Key and channel-id.

Header:

HTTP
Copy

Body:

HTTP
Copy

Fill the url field with your webhook URL

Example:

CURL
Copy

Example Response:

On Cloud
On Premise
Copy

You can see the webhook payload from WhatsApp by following the docs:

Type Of Message

There are several types of post messages:

Session Message

You can start to chat with your own number as a customer.

Please refer to this documentations as well to understand the possibility of the payload :

  1. When your customers sends a message, WhatsApp API will hook a message to Qiscus Omnichannel Chat Server.
  2. Qiscus Omnichannel Chat Server forwards message to your webhook.
  3. If you want to reply to that message, please follow the next process. If not, stop right there.
  4. WhatsApp has to validate your reply. If your last customer message is more than 24 hours, your reply can not be sent. You must use an approved template if you want to send a message after 24 hours of the last customer's message.
  5. If your last customer message is less than 24 hours, your customer gets the reply.
  6. We notify you a response of the reply to your webhook.

URL:

HTTP
Copy

Please follow this page to get your App ID, Qiscus Secret Key and channel-id.

Header:

HTTP
Copy

Body:

HTTP
Copy

Example:

HTTP
Copy

Example Response:

On Cloud
On Premise
Copy

This response comes from Qiscus WhatsApp Message API, which means we will process your message to WhatsApp API to send your reply to your customer. Parameter messages.id is a reference to id that you can match in the response that you get in your webhook.

Example Content Webhook:

HTTP
Copy

Template Messages

You need to setup template first, you can find how to submit the template in this docs, if you already have then you can continue to use this API. The template should be approved.

Please refer this documentations as well to understand the possibility of the payload:

On Premise

  1. https://developers.facebook.com/docs/whatsapp/api/messages/message-templates
  2. https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/media-message-templates

On Cloud

  1. https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-message-templates

Please follow this page to get your namespace, template__name and language__code.

URL:

HTTP
Copy

Please follow this page to get your App ID, Qiscus Secret Key and channel-id.

Header:

HTTP
Copy

Body:

HTTP
Copy

Example:

HTTP
Copy

Example Response:

On Cloud
On Premise
Copy

This response comes from Qiscus WhatsApp Message API, which means we will process your message to WhatsApp API to send your reply to your customer. Parameter messages.id is a reference to id that you can match in the response that you get in your webhook.

Example Content Webhook:

HTTP
Copy

Interactive Messages Template

Quick Reply

Please refer this documentation as well to understand the possibility of the payload: https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/interactive-message-templates.

URL:

HTTP
Copy

Please follow this page to get your App ID, Qiscus Secret Key and channel-id.

Header:

HTTP
Copy

Body

HTTP
Copy

Example:

HTTP
Copy

###

Call To Actions

Please refer this documentation as well to understand the possibility of the payload: https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/interactive-message-templates.

URL:

HTTP
Copy

Please follow this page to get your App ID, Qiscus Secret Key and channel-id.

Header:

HTTP
Copy

Body:

HTTP
Copy

Example:

HTTP
Copy

List Messages & Reply Buttons

Please refer this documentation as well to understand the possibility of the payload:

  • Interactive messages can be combined together in the same flow.
  • Users cannot select more than one option at the same time from a list or button message, but they can go back and re-open a previous message.
  • List or reply button messages cannot be used as notifications. Currently, they can only be sent within 24 hours of the last message sent by the user. If you try to send a message outside the 24-hour window, you get an error message.
  • Supported platforms: iOS, Android, and web.
  • This message doesn't eat up your quota outbound message
  • When a user replies the interactive message it will deliver webhooks notifications through 2 streams

read more: https://developers.facebook.com/docs/whatsapp/guides/interactive-messages

URL:

HTTP
Copy

Please follow this page to get your App ID, Qiscus Secret Key and channel-id.

Header:

HTTP
Copy

Body:

HTTP
Copy

Example:

HTTP
Copy

Other example for quick reply buttons:

HTTP
Copy

Catalog Product

You can easily showcase and share your products and services with customers by sending a catalog to your customer via WhatsApp Business API. Refer to this documentation for more information about Catalog Product.

Please Contact Us, if you want to connect your catalog product to Qiscus Omnichannel Chat dashboard.

URL:

HTTP
Copy

Please follow this page to get your App ID, Qiscus Secret Key and channel-id.

Header:

HTTP
Copy

Body:

HTTP
Copy

Example:

HTTP
Copy

Other Example for Multiple Product:

HTTP
Copy

If you face difficulties during sending the Interactive API because of any error or issue on the WhatsApp Server version, please submit ticket, our engineering team will help you.

When user replies the WhatsApp interactive message you will get data from webhook

###

Please refer to this documentation to understand the detailed payload.

Please contact support@qiscus.com to request the creation of a carousel template, we will assist you with it.

URL:

HTTP
Copy

Please follow this page to get your App ID, Qiscus Secret Key and channel-id.

Header:

HTTP
Copy

Body:

HTTP
Copy

To use media on this API, you need to contact us for uploading purposes, as WhatsApp does not allow the use of plain URLs

Sending Templates with Flow

Message templates with Flow allows businesses to create message template flows within WhatsApp. It helps guide users through a series of steps or options to complete a task or get information. Please refer to this documentation for more details.

Ensure that your template passes all required reviews so that status is APPROVED instead of PENDING.

URL:

HTTP
Copy

Header:

HTTP
Copy

Body:

HTTP
Copy

Example:

HTTP
Copy

Sending Interactive Message Templates with Flow

WhatsApp Flow Interactive Message is a feature that allows businesses to create menu options within a conversation, WhatsApp Flow Interactive Message enabling customers to select choices and making interactions easier. Please refer to this documentation for more details.

URL:

HTTP
Copy

Header:

HTTP
Copy

Body:

HTTP
Copy

Example:

HTTP
Copy

###

Previous WhatsApp Messages API

You can also still using these APIs, we will not deprecate these API yet until further notice.

Here is the API for sending text template: https://documenter.getpostman.com/view/8259884/SzKMzMYz#83863325-fa2d-499b-bfc1-83ff08935a29

Here is the API for sending text template with image/video/pdf header: https://documenter.getpostman.com/view/8259884/SzKMzMYz#e0a7e389-6195-4da9-a25d-b1ecd9eee4e9.

For any further question you can ask us via : https://support.qiscus.com/hc/en-us.

Upload Media API

Use this API to upload your media. The media is stored on the WhatsApp servers for 14 days. Please refer to this documentations.

URL :

HTTP
Copy

Please follow this page to get your App ID, Qiscus Secret Key and channel-id.

Header :

HTTP
Copy

supported of content-type

application/pdf, image/jpeg, image/jpg, image/png, and video/mp4

Body :

--data-binary
Copy

Example :

CURL
Copy

Example Response :

On Cloud
On Premise
Copy

Retrieve Media API

Use this API to retrieve the media that you uploaded before. {{IdMedia}} refers to media.id from the response of Upload Media API. Please refer to this documentations.

URL :

HTTP
Copy

Please follow this page to get your App ID, Qiscus Secret Key and channel-id.

Header :

HTTP
Copy

Example :

HTTP
Copy

Location

Use this API for send location message type to your customer. Please refer to this documentation as well to understand the possibility of the payload.

URL :

HTTP
Copy

Please follow this page to get your App ID, Qiscus Secret Key and channel-id.

Header :

HTTP
Copy

Body :

HTTP
Copy

Example :

HTTP
Copy

Example Response :

On Cloud
On Premise
Copy

Typing Indicators

Typing Indicator serves as a visual cue to WhatsApp users, indicating that the business is currently preparing a response. This indicator can enhance the user experience by providing a sense of responsiveness and interactivity, especially when the business needs time to respond to the message.

When a message is received, the business can send a read receipt (to indicate the message has been read) and simultaneously show a typing indicator to signal that a reply is being prepared. These two features can be sent in a single API request.

The typing indicator will automatically disappear when:

  • The business sends a reply, or
  • After 25 seconds, if no message is sent.

To send a typing indicator along with a read receipt, you can use the following API request:

URL :

HTTP
Copy

Header :

HTTP
Copy

Body :

You can obtain the message_id required for this request from the incoming message payload, which can be accessed through this documentation.

HTTP
Copy

Example Request:

HTTP
Copy

Example Response :

Javascript
Copy

Guides

We provide a guide to help you get the most out of the WhatsApp Business API

How to Use WABA Catalogue API

Before using WABA Catalogue API, please Contact Us to connect your catalog product to Qiscus Omnichannel Chat dashboard.

You can use WhatsApp Business API to share your products while chatting with their customers in the form of a catalog. There are two types of catalogs you can create, Multi-Product Messages and Single Product Messages. Multi-Product Messages allows you to send a catalog of up to 30 items. While Single Product Messages, the catalog will be a single product displayed with details.

This guide will show you how to use WhatsApp business API to send catalog with Single Product Messages.

The catalog will only be sent if the conversation is within the 24 hours open window

  1. Create catalogue in Facebook Commerce Manager,
  2. Give Qiscus access in Assign Partner under Commerce Manager catalog by accessing this page Facebook business Setting. After that, you can follow these step:
  • Click the Add button in the Partner to share assets with section and enter Qiscus Business ID. Please contact our team to get Qiscus Business ID.
  • Select Catalog in the pop up that appears and select the catalog you want to assign then click Save,
  • Qiscus has become your partner and the catalog you previously assigned will be visible in the Assigned Assets section,
  1. You should also give Qiscus BSP Admin access to Commerce Manager to manage the catalog by add People to Facebook business Setting and follow these steps:
  • Please contact our team to get the Qiscus BSP Admin email address. Click Add button in the People section,
  • Fill in the email address that you have received. Make sure you activated toggle Admin access and then click Next,
  • Select Catalog in the pop-up that appears and selects the catalog you want to assign then click Invite. Don’t forget to give Qiscus BSP admin full control of the catalog,
  • Please confirm with our team after you add the email address. Once the invitation is accepted, You will see the list of connected people and the shared catalog.
  1. Admin Qiscus will connect Catalog to the WABA Business Manager,
  1. Before using the WABA Catalog API, please note the following:
  • To send a catalog, the 24-hour windows must be active.
  • You can view the documentation on parameters for interactive messaging API here.

You can start posting the API using this curl:

HTTP
Copy

You can get catalog _id and product_retailer_id in the Facebook Commerce Manager.

catalog_id refers to the ID of the catalog you want to use. The red arrow in the following image shows where you can get the catalog_id.

While product_retailer_id refers to the Content ID of your items in the catalog you want to use. You can get product_retailer_id as shown in the image below.

  1. The catalog will appear like these on the Customer's WhatsApp,
  1. Client need to subscribe WhatsApp webhook to listen the response from client when interacting with the Catalog,
  2. Client can then respond to the customer using WhatsApp API provided by Qiscus.

How to Enable Catalog on WhatsApp Business Profile

After you have successfully integrated your product catalog with your WhatsApp Business Account, the product catalog icon will not appear on your profile by default. Here is an example of a WhatsApp Business profile without the product catalog icon.

Please make sure the catalog you are going to use is connected to your WhatsApp Business Account.

However, you can enable the product catalog on a per-business phone number basis. Once it's enabled, the product catalog icon will appear in your conversations and on your WhatsApp business profile. To enable this setting, please contact us and submit a request.

Once our team enables the catalog for your WhatsApp Business, the product catalog icon will appear as shown below:

  • The product catalog icon in the conversation.
  • The product catalog icon on the WhatsApp business profile.

This will allow your customers to easily browse and purchase your products directly on WhatsApp.

If you have any questions or need assistance with setting up your product catalog, please don't hesitate to contact us.

How to Use WhatsApp for OTP Authentication

WhatsApp officially released the new pricing on June 1, 2023. Business-initiated conversations will be split into three new categories: utility, authentication, and marketing. Meanwhile, user-initiated conversations will be called service conversations.

Accordingly, WhatsApp is set to introduce a new feature called "Authentication templates with one-time password buttons". Please take note of the following important details regarding Authentication templates:

  1. Sending a broadcast will fail if you attempt to use an old template with OTP/Authentication category that contains media, links, or emojis.
  2. While it is still possible to create new templates with the authentication category through the Qiscus Omnichannel Chat dashboard, please be aware that these templates will be rejected due to a distinct message structure. To resolve this, you must edit the template via Facebook Business Manager.

Differences with the old OTP template

Previously, OTP templates had the flexibility to include multiple elements, such as images or several variables. However, Starting from May 29, 2023, any newly created authentication templates must adhere to the following guidelines:

  • Templates should not include links, media, or emojis.
  • Each parameter within the template should not exceed a maximum length of 15 characters.
  • The template should include Copy Code button.

A copy code button copies the one-time password or code to the user's clipboard. The user can then manually switch to your app and paste the password or code into your app's interface.

Example for authentication templates with one-time password button:

Before sending OTP via WhatsApp, first you need an Authentication Template. However, the API used to create the Authentication Template is slightly different due to the new guidelines from WhatsApp. To understand more about the differences, refer to this API documentation.

You can send OTP message with a copy code button via the API by using this cURL:

cURL Syntax:

HTTP
Copy

Response:

HTTP
Copy

Example Request:

HTTP
Copy

Example Response:

HTTP
Copy

The OTP message will appear like these on the Customer's WhatsApp:

How to Create and Send a Template with up to 10 Buttons

Facebook Business Messenger offers a feature that allows you to create message templates with a combination of up to 10 buttons, including Call to Action (CTA) Buttons and Quick Reply Buttons. You can use up to 3 Call to Action buttons to direct customers to a website, initiate a phone call, or other specific actions, and up to 8 Quick Reply buttons that enable customers to respond quickly with a single click. This feature is designed to simplify interactions, enhance communication efficiency, and provide a more interactive user experience.

Facebook Business Messenger has specific guidelines and limitations for adding buttons to message templates, Button Types:

  1. Call to Action Buttons: Allows your customer to call a phone number and visit a website.

    1. Visit Website: 2 buttons maximum,
    2. Call Phone Number: 1 button maximum,
    3. Complete Flow: 1 button maximum,
    4. Copy Offer Code: 1 button maximum.
  2. Call to Action Buttons: Allows your customer to call a phone number and visit a website.

    1. Marketing Opt-out,
    2. Custom.

Here are the steps to create a message template with button combinations via Facebook Business Manager:

1. Create a New Template:

  • Click Create Message,
  • Setup your template, you can choose the category (Marketing, Utility or Authentication), then select Custom and click Next.
  • Enter Template name and language.

2. Add Message Content:

  • Fill out the header, body and footer section of your template and Enter the text or media you want to include in the message content.

3. Add Buttons and Submit Template

Create buttons that let customers respond to your message or take action. You can add up to 10 buttons. If you add more than 3 buttons, they will appear in a list.

Call to Action (CTA) Buttons:

  • Click Add Button,
  • Choose the CTA buttons type, such as Visit Website/ Call Now/ Copy offer code,
  • Enter the button text and fill in the required URL or phone number.

Quick Reply Buttons:

  • Click Quick Reply Buttons, select Marketing Opt-out or Custom,
  • Add the short response text you want to display on the button.

you can add a total combination of up to 3 buttons (CTA and/or Quick Reply).

  • Click Submit for Review, confirmation pop-up will appear and click Confirm.
  • Wait until the message template approve from Facebook.
  • If the message template is approve by Facebook, the status will be active, and you can use it.

Sent Message Template with Buttons Combination via the API by using this cURL:

cURL Syntax:

HTTP
Copy

Response:

HTTP
Copy

Example Request:

HTTP
Copy

Example Response:

HTTP
Copy

and this is the result of sending message template with button combination via the API

  • Qiscus Omnichannel Chat Preview:
  • Customer Preview:

Glossary

APP-ID , Secret Key

  1. Log in to Qiscus Omnichannel Chat account with your email and password.
  2. Go to ‘Setting’ menu on the left bar.
  3. Select ‘App Information’.

channel-id

  1. Log in to Qiscus Omnichannel Chat account with your email and password.
  2. Go to ‘Integrations’ menu on the left bar.
  3. Select ‘WhatsApp Integration’.
  4. Look for your WABA and select it.
  5. Take a look at the part of the Webhook URL at the bottom of the page.
  6. Get the last series of number.

Namespace , Template Name, Language

  1. Log in to Qiscus Omnichannel Chat account with your email and password.
  2. Go to ‘Outbound’ menu on the left bar.
  3. Select ‘WhatsApp Broadcast Template’.
  4. Look for your Approved Template and select it.
  5. namespace for Namespace, template_name for Template Name, language_ code for Language. Please check this docs.
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated