[英]HTML link for add contact to whatsapp
I need to put a deep link in my HTML for adding a contact to the Phone and then begin a new conversation in whatsapp.我需要在我的 HTML 中放置一个深层链接以将联系人添加到电话,然后在 whatsapp 中开始新的对话。
I found this code我找到了这个代码
<a href="whatsapp://send?text=Hello%2C%20World!">Send text to whatsapp</a>
And this one:和这个:
<a href="whatsapp://send?abid=username&text=Hello%2C%20World!">Send text to user</a>
I need to open a conversation with a specific contact even if I don't have the contact.即使我没有联系人,我也需要与特定联系人进行对话。 My first question is, where can I get the username for whatsapp?
我的第一个问题是,我在哪里可以获得 whatsapp 的用户名?
Having the abid I can try if it works but I dont know where to get that data.有了 abid 我可以尝试它是否有效,但我不知道从哪里获取这些数据。
Thanks a lot非常感谢
<a href="https://api.whatsapp.com/send?phone=NUMBER">Send Message</a>
Without "+" or "00" at the beginning, just start country code and the number.不以“+”或“00”开头,只以国家代码和数字开头。 Example USA is +12025599025 then in the code given, replace NUMBER with 12025599025
例如 USA 是 +12025599025 然后在给定的代码中,用 12025599025 替换 NUMBER
this was worked for me:这对我有用:
whatsapp://send?text=MESSAGE&phone=+NUMERO&abid=+NUMERO
Obviusly "+NUMERO" is the wsp number and "MESSAGE" the preloaded message put in in
href` attribute Obviusly“+ NUMERO”是WSP数和“MESSAGE”预加载的消息放于
in
href`属性
Malki's answer does solves the issue, but recently there's been published an official Whatsapp API I mentioned in THIS OTHER ANSWER (because SO policies I had to put a link to the solution, no duplicates). Malki 的回答确实解决了这个问题,但最近发布了我在这个其他答案中提到的官方 Whatsapp API(因为 SO 政策我不得不放一个指向解决方案的链接,没有重复)。
This doesn't directly add the contact but allows you to open a copnversation with a concrete number, it can be very usefull to use it in your web sites.这不会直接添加联系人,但允许您打开带有具体号码的对话,在您的网站中使用它可能非常有用。 I've just found that it is possible to open a conversation to a number Using Click to Chat
我刚刚发现可以使用“点击聊天”与某个号码进行对话
To create your own link with a pre-filled message that will automatically appear in the text field of a chat, use
https://wa.me/whatsappphonenumber/?text=urlencodedtext
where whatsappphonenumber is a full phone number in international format and URL-encodedtext is the URL-encoded pre-filled message.要使用自动出现在聊天文本字段中的预填充消息创建您自己的链接,请使用
https://wa.me/whatsappphonenumber/?text=urlencodedtext
其中 whatsappphonenumber 是国际格式和 URL 的完整电话号码-encodedtext 是 URL 编码的预填充消息。
Example: https://wa.me/15551234567?text=I'm%20interested%20in%20your%20car%20for%20sale
示例:
https://wa.me/15551234567?text=I'm%20interested%20in%20your%20car%20for%20sale
: https://wa.me/15551234567?text=I'm%20interested%20in%20your%20car%20for%20sale
NOTE: It opens WhastApp application if you click the link using a mobile phone browser (at least from Android)注意:如果您使用手机浏览器(至少在 Android 上)单击链接,它会打开 WhastApp 应用程序
The ABID (address book ID) is for an ID, not a name on your contact list. ABID(地址簿 ID)用于 ID,而不是联系人列表中的姓名。
In Whatsapp URL Scheme Documentation There are not (yet) documentation to send message to a specific contact.在Whatsapp URL Scheme 文档中没有(还)文档可以向特定联系人发送消息。
The best way i found is to add the contact using this html code:我发现的最好方法是使用此 html 代码添加联系人:
<a href="tel:0123456789">add number</a>
(this will open Contacts app from your phone) (这将从您的手机打开通讯录应用程序)
This is how you can create a link to send a WhatsApp message to a particular number.这是您创建链接以将 WhatsApp 消息发送到特定号码的方法。
Notice that you don't need to add the '+' symbol before the country -code.请注意,您不需要在国家/地区代码前添加“+”符号。 Just start with the country-code followed by the WhatsApp number:
只需从国家代码开始,然后是 WhatsApp 号码:
<a href="https://api.whatsapp.com/send?phone=919854098540" target="_blank">Link Icon</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.