All Products
Search
Document Center

Chat App Message Service:Send OTP messages to global users

Last Updated:Oct 30, 2025

This topic describes how to use Chat Flow of Chat App Message Service to send one-time password (OTP) messages to global users.

Background

According to statistics from the end of 2023, WhatsApp has over 2 billion active users across nearly 200 countries and regions. It has become a vital channel, not just for personal communication but also for commercial activities. Its phone-number-based account system makes WhatsApp an effective tool for reaching target users. Many enterprises prioritize it for sending OTPs, notifications, and marketing campaigns to their global audience.

However, businesses with a global user base often find that relying solely on WhatsApp for OTP delivery yields unsatisfactory results.

There are two core reasons for this:

  • Although OTPs, notifications, and marketing messages are all sent via channels like SMS, email, or instant messaging (IM) apps, they differ in purpose, content, and user expectation. For example, an OTP must complete an identity verification, usually within one minute. This demands higher accuracy and timeliness, and the criteria for successful delivery are simple and absolute.

  • While WhatsApp is popular worldwide, its penetration rate varies across countries. Each country has its own dominant IM apps. This disparity means that in some regions, WhatsApp is not the user's primary choice, lowering OTP delivery rates.

As a result, when an enterprise serves a massive, global user base, a single-channel WhatsApp strategy will inevitably perform unevenly. To solve this problem, businesses must have comprehensive coverage of all mainstream communication channels. But how can you differentiate between countries for millions of phone numbers? And once identified, how do you send messages through multiple channels?

Solution

Use Chat Flow of Chat App Message Service to identify a number's origin and send messages through multiple channels.

Chat App Message Service is a powerful message engine from Alibaba Cloud, designed to help businesses reach users effectively. It lets you use the messaging services of multiple overseas social media platforms like WhatsApp, Viber, Messenger, and Instagram, enhancing user interaction with a rich variety of message types. To make it easy to use, the service includes a built-in flow editor: Chat Flow. This tool enables any employee in your company to build interactive flows using a low-code approach.

Chat Flow provides a large canvas. The left side of the canvas offers a wide variety of components for messaging, flow control, AI capabilities, and marketing. Drag and drop these components onto the canvas and configure them with simple settings to implement a chat flow as needed.

Chat Flow has four main function categories: Channel Dock, Flow Dock, AI Dock, and Marketing Dock. For details, see Overview.

Chat Flow has the following benefits: ease of use, ease of maintenance, high flexibility, deep integration, and wide applicability. For more information, see the "Benefits" section of the Overview topic.

209d1e6d64eb0dfd883a1211beb5f267

User guide

Scenario: Your user base spans multiple countries. You decide to use Viber to reach users in the Philippines, WhatsApp for users in Malaysia, and SMS for all other countries.

Canvas flow diagram:

image.png

Procedure

  1. Configure variables.

    Go to Chat Flow > Flow Management. Click the name of a flow whose Trigger Type is Manual. On the canvas that appears, click Start. In the right-side pane, turn off Do not accept incoming variables. In this example, specify the customerPhoneNumber and verificationCode variables.

    image

  2. Create PH and ML branches.

    From the component library, drag the Recognize a Phone Number component to the canvas. In the right-side pane, turn on Multi-branching. To branch based on country/region code, select Region Code for Branch Office. From the Branch drop-down list, select the international codes for your target countries, such as the Philippines (PH) and Malaysia (ML). Set the Output Code Variable Name. Subsequent components can reference this variable.

    image

  3. Configure the else branch.

    Drag the Send an SMS Message component to the else branch. In the right-side pane, set the Sender ID. For the recipient's phone number, select the customerPhoneNumber variable defined in the Start node. In the Message Content section, select Verification Code for the Content Type parameter and enter a message text. In this example, the following text is used:

    "Your one-time password is:{{verificationCode}} The password is valid for 10 minutes. Please do not tell anyone the password to avoid losses."

    Here, {{verificationCode}} is the OTP variable you defined in the Start node. To add variables, enter {{ and select from the list of all available variables at the current component.

    image

    Note

    Configuring the else branch first is a best practice. It establishes a universal fallback channel that other branches can jump to if their primary delivery attempts fail.

  4. Configure the PH branch.

    Drag the Send a Viber Message component to the PH branch. In the right-side pane, configure parameters in the Message Sending Settings, Message Settings, and Timeout Settings sections.

    • In the Message Sending Settings section, select From/To for the Action parameter and select Transaction for the Message Type parameter. Select Service Id for the Sending Type parameter and select a Viber channel for the Channel parameter. Then, enter {{ to specify the customerPhoneNumber variable that is defined in the Start node for the Recipient parameter.

    • In the Message Settings section, select Text for the Message Type parameter and enter a text for the Content parameter. In this example, the following text is used:

      Your one-time password is:{{verificationCode}} The password is valid for 10 minutes. Please do not tell anyone the password to avoid losses.
      Note

      In the text, verificationCode is the variable name for verification code that is defined in the Start node.

      image

    • Timeout settings: To help ensure users receive the OTP, configure timeouts to trigger fallback actions if a message is not delivered or read within a specified period.

      image

      In this example, if the message is not delivered via Viber within 30 seconds, the flow will attempt to send a WhatsApp message. If the user does not read the message within 60 seconds, the flow will fall back to sending an SMS.

      Send a WhatsApp message if not delivered within 30 seconds

      Procedure

      1. Drag the Send a WhatsApp Message component to the undelivered branch of the Send a Viber Message component.

      2. Click the Send a WhatsApp Message component. In the Message Sending Settings section, select From/To for the Action parameter and select Mobile Number for the Sending Type parameter. Select a WhatsApp channel for the Channel parameter and select a verified WhatsApp number for the Sender Mobile Number parameter. Then, enter {{ to specify the customerPhoneNumber variable that is defined in the Start node.

      3. In the Message Settings section, select Template Message for the Message Type parameter, select the channel specified in the Message Sending Settings section, and then select a template. Templates must be created in advance and approved by WhatsApp.

        image

      Send an SMS if not read within 60 seconds

      Procedure

      1. Drag the Jump to Another Step component to the unread branch of the Send a Viber Message component.

      2. Click the Jump to Another Step component. In the Basic Configuration section of the right-side pane, select the Send an SMS Message component for the Jump To parameter. Configure the Maximum Jumping Times parameter. This setting prevents infinite loops by limiting how many times the flow can trigger this jump in a single execution. For example, a value of 3 means the jump will trigger the first three times it is reached but will be skipped on the fourth attempt.

        image

      You can also configure the undelivered and unread branches for this Send a WhatsApp Message component. In this example, if a WhatsApp message is not delivered within 30 seconds, the system jumps to the else branch to use the Send an SMS Message component to send the message. The configurations are similar to those in this step. You must specify the name of the component to which you want to jump. The component name is customizable.

    Note

    For users in the Philippines, this creates a resilient delivery chain. The system first attempts to send the OTP via Viber. If that fails, it immediately tries WhatsApp. If WhatsApp also fails, it falls back to SMS, maximizing the chance of reaching the user.

  5. Configure the ML branch.

    In the ML branch, configure the flow for Malaysian numbers. The logic is the reverse of the PH branch: prioritize WhatsApp, with Viber as the fallback. First, use a Send a WhatsApp Message component. If that message is undelivered, use a Send a Viber Message component. If the Viber message also fails, use a Jump to component to redirect to the universal Send a SMS Message component in the else branch. If the initial WhatsApp message is delivered and read, the flow ends.