Home » Use Cases

Send Verification Codes to Your Customers

Send verification codes - 2FA authentication -phone number verification - high -level overview

If a customer wants to create an account on your web page—they will need to send a verification code to you via WhatsApp, in order to verify their phone number. If the code has been verified in your system, the customer will receive a confirmation that the verification has been successful and will be able to continue using your web page safely.

The main goal of the process is to create a more reliable verification system with a two way-communication.

Process Workflow

Send verification codes - 2FA authentication -phone number verification - diagram

IMPLEMENTATION STEPS

In this case, since the customer is the one who is initiating the conversation, you can reply with a free-form message. But, just for showcase, we will use a templated message instead. Before you can send any kind of templates, such as a phone_number_verification  template, the template needs to be approved by WhatsApp. Once you create your message template, you can reuse it, personalize it for different customers, as well as attaching the appropriate invoice for each customer.

Use additional placeholders to personalize your message text.

The phone_number_verification notification is already approved by WhatsApp, as shown in the table below. Bear in mind that this specific template can be reused for different customers by editing the values in the placeholders.

TEMPLATE REGISTRATION

For template registration, you need to provide the template name, notification content, and language info, after which Infobip sends the template to WhatsApp for approval.

After the template has been registered, you will need to create a link that will allow your customers to to start a chat with you. After they click on the link on your web page, they will be automatically redirected to WhatsApp, with a personalized message linking to your WhatsApp account.

If you want to create your link with a pre-filled message that will automatically appear in the text field, use https://wa.me/whatsappphonenumber?text=urlencodedtext  where the whatsappphonenumber is your phone number in full international format and urlencodedtext is the URL-encoded pre-filled message.

In this case, the link will look like this:

https://wa.me/15551234567?text=r5453-23421, where r5453-23421 is the verification code that the user will receive.

When the customers click on the link, they will be redirected to a page that says:

Phone number verification over WhatsApp

After the customer click Send, they will be forwarded to your WhatsApp account, and the prefilled message r5453-23421 will appear.

If the verification code is correct, they will receive a templated message which confirms it.

Find out more about the WhatsApp click to chat feature.

Steps over API

To send this notification to a specific passenger using the WhatsApp API, follow the steps described below.

  1. Log in to Infobip API Resource hub and copy your BASE URL. Your personal base URL is: https://{{BASE_URL}}.api.infobip.com/

NOTE

The personal BASE URL is a simple way to identify who sent out the API request. This means we can identify the request through DNS and then find the optimal route for API requests.

  1. To send an approved message Template, use Postman or similar API development tools, then choose the POST method.

  2. Replace the endpoint with https://{{BASE_URL}}.api.infobip.com/omni/1/advanced.

  3. Add the Authorization header. For example, Basic: Base64 encoded username and password. Learn more about Authentication on our Infobip API Resource hub.

  4. Copy the scenarioKey you previously created. Learn more about Creating a scenario.

Request example:

{
   "scenarioKey":"CC9F01A5DC7BEE2C2B829D203482A654",
   "destinations":[
      {
         "to":{
            "phoneNumber":"41793026727"
         }
      }
   ],
   "whatsApp":{
      "templateName":"phone_number_verification",
      "templateData":[
         "Jenny“
      ],
      "language":"en"
   }
}
  1. templateNametemplateData, and language are mandatory for you to successfully send the notification. templateData should contain the same number of elements as placeholders in the registered template. In case the template does not contain any placeholders, templateData field should be an empty array “[ ]”.

Related Products

Communicate with your customers over the world’s most used Chat app