If you have a product or business that maintains user information like phone numbers, verifying the validity or ownership of the phone number could become important, as the phone number can be used as an authentication method or targeted marketing channel. The typical phone verification procedure is by generating a code or OTP in our application, sending that OTP to the user's phone, and then the user should insert the OTP in our application for verification. The OTP can be sent to the users through services like SMS or WhatsApp that require a valid phone number. For internet-based communication, WhatsApp has become the de facto standard for sending the OTP. WhatsApp requires its users to have a valid phone number during account creation, and it already has a huge number of users, approximately 3 billion in 2025.
Using that common procedure, WhatsApp will charge us for each OTP sent. The cost depends on the country of the target phone number. For Indonesia, typically the cost is around IDR 350 per OTP sent, depending on the service provider. There is another method that can clear out the cost. It is based on the WhatsApp pricing scheme itself that will not charge us for receiving messages from our users or directly replying to those messages within a 24-hour window. After 24 hours, we can only send messages using pre-approved templates, which may come with a cost. User-initiated conversations do not count against your messaging limits, allowing you to reply freely.
Understanding this WhatsApp policy, we can set different flows for verifying user phone numbers.
- First, register a business and a WhatsApp phone number in Meta Business. Remember that the service we use is not the WhatsApp Business App on our mobile phone, but it is the WhatsApp cloud service that requires us to deploy a webhook to receive messages from WhatsApp.
- In our application, we can drive our user to send a special formatted message to our WhatsApp Cloud phone number. We can generate a link filled with text that contains a special message that our application will understand. The link format is typically like this: http://wa.me/YOUR_PHONE?text=SPECIAL_MESSAGE
- When our webhook receives the users' messages, the webhook should be able to differentiate between normal messages and messages for phone verification based on the format we have specified. We can extract the user phone number information along with the special code contained in the message.
To implement this phone verification flow, there is a free service we can utilise. It is available on bilangin.com. This method still requires us to maintain our own WhatsApp Cloud phone number in Meta Business, but without the need for a custom webhook deployment. These are the steps we should follow to use this free service.
First, after registering a WhatsApp account for your business, generate an access token by creating a service account in Meta Business, and give the account the required permissions to access WhatsApp messages.
Second, store your WhatsApp information in bilangin.com, including the access token.
Third, after the creation, keep the webhook URL and the verification token shown in the bilangin.com dashboard.
Fourth, create an application in Facebook Developer, enable the WhatsApp integration, and configure the webhook. Set the webhook to subscribe to WhatsApp message events.
Fifth, create a phone verification entry in bilangin.com. This entry will define how Bilangin will process your users' messages and pass the extracted information to your application for phone verification. Keep the handler ID for the later step.
Double-curly braces are used to extract your application-defined variables included in the user text message. Single-curly braces are for system variables such as message metadata. Currently, it is only for the "{PHONE}" variable to retrieve users' phone numbers in received WhatsApp messages.
Sixth, prepare your application to handle phone verification requests from your users. It includes generating a model and a message formatter to provide a message that will be sent by your user. Bilangin accepts the following text message format.
###PV###<HANDLER_ID> | <KEY1>: <VAL1> | <KEY2>: <VAL2> | Some texts
The message should start with "###PV###", followed by the handler ID. You can add multiple key-value pairs that need to be extracted for the verification process in your application, such as special code, request ID, etc. Each block is separated by the pipe symbol, "|".
Lastly, prepare your endpoint to handle the payload sent by Bilangin defined in the fifth step. The following diagram shows a general overview of the whole process.







Comments
Post a Comment