Create a link that will open Viber and WhatsApp and will send a message to me

蹲街弑〆低调 提交于 2020-01-09 19:33:10

问题


Everyone around used to use IM. On my site I need to put a link that will open given instant messaging application (both on PC and on mobile) and open a send message to my number - and I can't find a way!

I suppose to use some URL scheme to do that, but all I can find is (__number is my mobile phone number):

<a href="intent://send/__number__#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end">WhatsApp</a>

and

<a href="viber://add?number=__number__">Viber</a>

(I don't even know if I should use phone in +1202... or simple 1202... (that is, if the plus is needed)

but frankly speaking it won't work. Viber opens its window and then tells me it won't handle that request, and WhatsApp is not linked to intent scheme at all (tested at several devices and OSes).

So I please ask you to help me with this small problem: what kind of URL will open Viber and WhatsApp apps to let visitors of the site to contact me?


回答1:


What you need is called deep-linking, some examples for viber and whatsapp are:

Viber:

<a href="viber://pa?chatURI=[public account URI]&text=[message text]"> some text </a>

Whatsapp:

<a href="whatsapp://send?abid=[users name]&text=[message text]"> some text </a>

Sources:

http://origamiengine.com/deep-linking
https://support.viber.com/customer/en/portal/articles/2872423-deep-links




回答2:


For WhatsUp you can use this link, that will open a chat with you on mobile, just enter your phone without the + sign.

<a href="https://api.whatsapp.com/send?phone=123456789">WhatsUp</a>




回答3:


Viber link to user should be like this:

viber://contact?number=%2B0000000000000

Use international telephone number format without + but with %2B.




回答4:


Since you don't want to create a public account (aka viber links including /pa? ) then simple add the link: <a href="viber://chat?number=012345678901"">chat with me</a> The first two digits are country code and no + sign needed.




回答5:


Actually viber://add?number=XXXXXXXXX is not working for Desktop app, it's working only if you open from Mobile phone. For desktop you need to use viber://chat?number=XXXXXXXXX.

For whatsapp link is very simple: https://wa.me/XXXXXXXXXX.

Remember how to generate links for all messengers is unreal, so I always use https://msng.link/ for generating whatsapp and telegram link, it's very easy.




回答6:


For whatsapp it is easy.

use the following format **https://wa.me/123456/** and that's it. here 123456 means your whatsapp number with the country code. Don't include + or preceding 00 just put your number with the country code. like 912232232. Here 91 is country code and the rest is the phone number. this works with the app, and also for whatsapp web.

for Viber this format works with public accounts. if you have a viber username you can use the same method.

https://viber.me/username/ will send you to the page.

this even work for facebook. if your facebook profile is visible to search engines, you can use this method.

use the above format with fb.me/username this will redirect you to the facebook page of the user. I think it works for pages too. but I haven't tried.I believe it should work.



来源:https://stackoverflow.com/questions/41324364/create-a-link-that-will-open-viber-and-whatsapp-and-will-send-a-message-to-me

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!