Integrate WhatsApp on your Application? | by Ayush Tibra | May 2022

picture by Daniel Tanase on Unsplash

Almost all business-related queries, customer support chats, order status, and promotions go through Whatsapp today. There are big players in the market who are building various integrated AI chatbots through WhatsApp which help us to increase our business sales.

And of course every company has their own website or app and we want to redirect users to WhatsApp for certain queries etc. from our app.

So how can we link WhatsApp to our apps?

Step 1 :- Find out the mobile number you want to redirect users to
Create a link in this format:-

Where the is a full telephone number in international format. Omit parentheses, dashes, plus signs, and leading zeros when adding the phone number in international format.



Do not use :

Note:- This is called a universal link and it is a preferred method of linking to WhatsApp accounts as per their documentation.

Step 2 :- Attach this link to your event handler
There are different ways to attach this link to your app like a sticky WhatsApp icon on your website, a button on a page, etc.

Example: —

Redirects to WhatsApp on button click

As you can see in the code above, we’ve attached our universal WhatsApp link to this anchor tag and when user clicks on it, it will redirect user to WhatsApp.

But, did you notice anything after the number?

Do you know what that means?

Step 3 :- Add a pre-filled message in a chat text field

WhatsApp provides us with a way to include a pre-filled message that will automatically appear in the text field of a chat.
Create a link in this format-

Where the WhatsApp phone number is a full international format phone number and the URL encoded text is the URL encoded pre-filled message.


And that’s all!

“This is the final URL, you can use to redirect users from your application to WhatsApp”.

To note:- Attention, when you send a pre-filled message, it must be encoded.


This type of message will work without encoding, but if your message consists of a single character like & ,@ etc., it will truncate that message before that special character.

Example:- & body

It will only send butter as a pre-filled message, as it is not encoded.

Source link

Comments are closed.