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:-

https://wa.me/

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.

Example:

Utilize: https://wa.me/15551234567

Do not use : https://wa.me/+001-(555)1234567

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?
?text=hi

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-

https://wa.me/whatsappphonenumber/?text=urlencodedtext

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

Example:-
https://wa.me/15551234567?text=I’m%20interested%20in%20your%20car%20for%20sale

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.

Example:-
https://wa.me/15551234567?text=hi

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:-
https://wa.me/15551234567?text=butter & body

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


Source link

Comments are closed.