The Complete Guide to Sending WhatsApp OTP Via Qiscus Omnichannel Chat

whatsapp otp qiscus omnichannel chat

One Time Password (OTP) is a short code used to verify a user’s identity when they log in to an application. OTP protects users’ personal data, and to keep that data secure, each code is only valid for a few minutes. As an application service provider, you also share responsibility for keeping the OTP codes you send confidential.

OTP codes are usually sent via SMS. However, SMS has several security weaknesses, including messages that can be intercepted. That’s why it’s worth switching to WhatsApp OTP, sent through the WhatsApp Business API. WhatsApp encrypts messages on their way to the user, making them much harder to intercept than SMS. The WhatsApp Business API also offers fast delivery and room for longer messages.

Get the WhatsApp Business API by partnering with Qiscus, an official WhatsApp Business partner in Indonesia. Qiscus provides WhatsApp Business API services in one dashboard called Qiscus Omnichannel Chat. If you want to send WhatsApp OTP codes to your customers, follow the tutorial below.

Things to Know

Prepare the following before you send OTP codes via the WhatsApp Business API:

  1. WhatsApp Business API access. To enable it, contact Qiscus.
  2. An active Qiscus Omnichannel Chat account. Want to see how it works first? Book a demo with our team.
  3. WhatsApp integrated with Qiscus Omnichannel Chat. Follow the integration guide to connect your account.
  4. An OTP message template. See the product documentation to create one.
  5. Your server region. Your account is hosted in either Indonesia or Malaysia, and every API request must go to that region’s server URL. See the next section.

Choose the Right Server URL (Data Center Region)

Your Qiscus account lives in one data center region, and every API request in this tutorial must be sent to that region’s server URL.

RegionServer URL
Indonesia (ID)https://omnichannel.qiscus.com
Malaysia (MY)https://omnichannel-my.qiscus.com
Server URL by data center region.

The examples in this tutorial use the Indonesia server URL. If your account is in Malaysia, replace omnichannel.qiscus.com with omnichannel-my.qiscus.com. The paths, headers, request bodies, and responses stay the same.

Not sure which region you’re on? Check your dashboard’s address bar: omnichannel-my.qiscus.com means Malaysia, and omnichannel.qiscus.com means Indonesia. You can also ask your Account Manager or Qiscus support. To host your data in Malaysia, select Malaysia as your region when you register.

How to Send WhatsApp OTP via Qiscus Omnichannel Chat

Once your Qiscus Omnichannel Chat setup is complete, follow these steps.

1. Authentication

Before you send a WhatsApp OTP, get your AdminToken with the following API.

[POST] https://omnichannel.qiscus.com/api/v1/auth

Malaysia accounts: https://omnichannel-my.qiscus.com/api/v1/auth

Sample request body

{
    "email": "YOUR_EMAIL",
    "password": "YOUR_PASSWORD"
}

Example request

curl --location --request POST 'https://omnichannel.qiscus.com/api/v1/auth' \
--form 'email=YOUR_EMAIL' \
--form 'password=YOUR_PASSWORD'

Example response

{
    "data": {
        "user": {
            "id": 2,
            "name": "Qismo",
            "email": "qiscus_xxxx_YOUR_EMAIL",
            "authentication_token": "QEXevusxxxxxxxxxx1lsl8",
            ...
        },
        "long_lived_token": "CztxxxxxxxxxxxxxxxjtS",
        "user_configs": {
            "notifagentjoining": null,
            "is_notifagentjoining_enabled": true,
            "notifmessagecoming": null,
            "is_notifmessagecoming_enabled": false
        }
    }
}

The response contains your AdminToken. Use it in the Authorization header in the next steps.

2. Choosing the Template

Qiscus Omnichannel Chat provides several ready-to-use OTP templates. See the template details in our documentation. To create a new template, open the Outbound Message menu on the Qiscus Omnichannel Chat dashboard. The same page lists the templates you’ve already created.

Choosing the Authentication category for a new OTP template
Choosing the Authentication category for a new OTP template.
List of WhatsApp message templates you have created
List of WhatsApp message templates you have created.

OTP templates use WhatsApp’s Authentication category. Since 29 May 2023, Meta applies these rules to new authentication templates:

  • No links, media, or emojis.
  • Each parameter is at most 15 characters.
  • The template must include a Copy Code button, so users can copy the OTP and paste it into your app.

If an authentication template you created in the dashboard is rejected, edit it in Facebook Business Manager.

3. Using the API

After you get the AdminToken and pick a template, send the OTP through the API. This tutorial uses the sample template otp_confirmation_text. To find the channel_id, template_name, namespace, and other details, click View on the selected template.

Template details, including the namespace and language
Template details, including the namespace and language.

Send a WhatsApp OTP with this API:

[POST] https://omnichannel.qiscus.com/api/v3/admin/broadcast/client

Malaysia accounts: https://omnichannel-my.qiscus.com/api/v3/admin/broadcast/client

Header

KeyValue
Authorization{{AdminToken}}
Header description.

Body

KeyTypeDescription
channel_idOptionalChannel identifier. If empty, the first WhatsApp channel is used
template_nameRequiredName of the selected template
namespaceRequiredNamespace of the selected template
languageString, requiredLanguage of the selected template
variables[]Array of strings, requiredThe OTP code you want to send
phone_numberString, requiredThe phone number you want to send the OTP to
button_paramsRequired if the template has buttonsFill this in only if the message template has buttons
Body description.

Example request

curl --location --request POST 'https://omnichannel.qiscus.com/api/v3/admin/broadcast/client' \
--header 'Authorization: YOUR_ADMIN_TOKEN' \
--form 'channel_id=7xx' \
--form 'template_name=otp_confirmation_text' \
--form 'namespace=51dcd9a4_xxxx_xxxx_xxxx_xxxxxxbb5' \
--form 'language=id' \
--form 'variables[]=5678' \
--form 'phone_number=+628xxxxxxx321' \
--form 'button_params='

Example response

{
    "data": {
        "broadcast_job_id": 12345,
        "broadcast_logs": [
            {
                "id": 12371070,
                "message_id": "gBGHxxxSGUDxsVcB",
                "notes": null,
                "phone_number": "+628xxxxxxx321",
                "sent_at": "2026-10-13T03:47:14Z",
                "status": "sent",
                "variables": "[\"5678\"]"
            }
        ],
        "language": "id",
        "name": "otp_confirmation_text",
        "namespace": "51dcd9a4_xxxx_xxxx_xxxx_xxxxxxbb5"
    },
    "status": 200
}

The result

Here’s how the message looks in the customer’s WhatsApp.

The WhatsApp OTP message received by the customer
The WhatsApp OTP message received by the customer.

4. Checking If the Message Was Sent

You can check whether an OTP message reached the customer in two ways.

  • Via the Qiscus dashboard

Open the Outbound Message menu, then select WhatsApp Broadcasts to see your broadcast history. Click a broadcast to open its detail page, where the Broadcast Log section shows full details for each recipient.

Broadcast history on the Qiscus Omnichannel Chat dashboard
Broadcast history on the Qiscus Omnichannel Chat dashboard.

A message can have one of four delivery statuses:

  1. Sent: the message has been sent.
  2. Delivered: the message reached the customer but hasn’t been read yet.
  3. Read: the customer opened and read the message.
  4. Failed: the message couldn’t be delivered.

You can see each message’s status in the Broadcast Log section of the broadcast detail page.

Broadcast details with delivery statistics and message logs
Broadcast details with delivery statistics and message logs.
  • Via webhook

You can also receive message statuses through a webhook. To do this, set your webhook URL with this API:

[POST] https://omnichannel.qiscus.com/whatsapp/{{APP-ID}}/{{channel-id}}/settings

Malaysia accounts: https://omnichannel-my.qiscus.com/whatsapp/{{APP-ID}}/{{channel-id}}/settings

Header

KeyValue
Qiscus-App-Id{{APP-ID}}
Qiscus-Secret-Key{{Secret Key}}
Content-Typeapplication/json
Header description.

Find your App ID and Secret Key in the Qiscus Omnichannel Chat dashboard: open the Settings menu, then click App Information.

App Information in the Qiscus Omnichannel Chat settings
App Information in the Qiscus Omnichannel Chat settings.

Body

{
    "webhooks": {
        "url": "https://YOUR_DOMAIN_URL.com/receive_webhooks"
    }
}

Example request

curl -X POST \
  https://omnichannel.qiscus.com/whatsapp/YOUR_APP_ID/YOUR_CHANNEL_ID/settings \
  -H 'Qiscus-App-Id: YOUR_APP_ID' \
  -H 'Qiscus-Secret-Key: YOUR_SECRET_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "webhooks": {
        "url": "https://YOUR_DOMAIN_URL.com/receive_webhooks"
    }
}'

Example response

{
    "business_id": "xxxxxxxxxxxxxxx",
    "status": 200,
    "webhooks": {
        "url": "https://YOUR_DOMAIN_URL.com/receive_webhooks"
    }
}

Read more about webhook settings in the WhatsApp Business API documentation.

5. If the WhatsApp OTP Is Not Sent

An OTP message may fail to reach your customer because:

  • The customer’s phone number is wrong.
  • The phone number isn’t registered on WhatsApp.
  • The template is an older authentication template that contains links, media, or emojis (see Step 2).
  • The API request was sent to the wrong region’s server URL.

If the OTP message isn’t delivered, you can:

  1. Try sending the message again.
  2. Send the OTP through another channel connected to Qiscus Omnichannel Chat, such as SMS or email.

How to Hide WhatsApp OTP Codes in Your Inbox

OTP codes are confidential and protect your customers’ personal data. To keep them confidential, you can hide the OTP variable in the Qiscus Omnichannel Chat inbox, so only the customer can read it. Use the same API as in Step 3 and add hide_variables to the body.

[POST] https://omnichannel.qiscus.com/api/v3/admin/broadcast/client

Malaysia accounts: https://omnichannel-my.qiscus.com/api/v3/admin/broadcast/client

Header: the same as in Step 3.

Body: all the parameters from Step 3, plus:

KeyTypeDescription
hide_variablestrueHides the OTP code in the Qiscus Omnichannel Chat inbox
Body description.

Example request

curl --location --request POST 'https://omnichannel.qiscus.com/api/v3/admin/broadcast/client' \
--header 'Authorization: YOUR_ADMIN_TOKEN' \
--form 'channel_id=7xx' \
--form 'template_name=otp_confirmation_text' \
--form 'namespace=51dcd9a4_xxxx_xxxx_xxxx_xxxxxxbb5' \
--form 'language=id' \
--form 'variables[]=5678' \
--form 'phone_number=+628xxxxxxx321' \
--form 'button_params=' \
--form 'hide_variables=true'

You can get the AdminToken, channel_id, template_name, namespace, and other values the same way as in Step 3. The response uses the same format as the Step 3 example.

The result

Here’s how hide_variables changes the message in the Qiscus Omnichannel Chat inbox.

The OTP code hidden in the Qiscus Omnichannel Chat inbox
The OTP code hidden in the Qiscus Omnichannel Chat inbox.

Your WhatsApp Business API is now ready to send WhatsApp OTP codes to customers. Make sure to test the delivery before you go live.

Contact Qiscus for WhatsApp Business API Implementation

Qiscus Omnichannel Chat brings all your business conversations into one dashboard. It also includes solutions such as Chatbot and WhatsApp Chatbot to help you get more out of every customer conversation. Want to see it in action? Book a demo with our team.

Frequently Asked Questions

Can I send OTP via the WhatsApp Business API?

Yes. Once you have WhatsApp Business API access through an official partner such as Qiscus, you can send OTP codes with an approved authentication template and the broadcast API in Qiscus Omnichannel Chat.

Is WhatsApp OTP more secure than SMS OTP?

WhatsApp encrypts messages on their way to the user, so OTP codes are much harder to intercept than SMS, which can be intercepted in transit. WhatsApp also offers fast delivery and room for longer messages.

What are the rules for WhatsApp authentication templates?

Since 29 May 2023, Meta requires new authentication templates to have no links, media, or emojis, keep each parameter to 15 characters or fewer, and include a Copy Code button.

Why is my WhatsApp OTP not being delivered?

Common causes are a wrong phone number, a number that isn’t registered on WhatsApp, an older template that contains links, media, or emojis, or an API request sent to the wrong region’s server URL. You can resend the message or send the OTP through another channel, such as SMS or email.

How do I hide OTP codes in the Qiscus Omnichannel Chat inbox?

Add hide_variables=true to the body of the broadcast API request. The OTP code is then hidden in the inbox, so only the customer can read it.

You May Also Like