可以自定义移动网站,以允许用户将 WhatsApp 中的预填消息分享给手动选择的联系人。正如给定的 here 它是使用自定义 URL 方案完成的。一个例子:
<a href="whatsapp://send?text=Hello%20World!">Hello, world!</a>
要调用我们使用的特定号码:
<a href="tel:0123456789">Call</a>
同样,我们是否可以在用户不手动选择电话号码的情况下向特定号码发送 WhatsApp 消息(或至少打开聊天),而不是将其作为预定义参数/属性值之一?
最佳答案
向特定号码发送 WhatsApp 消息的格式(2018 年 11 月更新)
<a href="https://wa.me/whatsappphonenumber/?text=urlencodedtext"></a>
在哪里
whatsappphonenumber is a full phone number in international format
urlencodedtext is the URL-encoded pre-filled message.
示例:
创建一个包含预填信息的链接 自动出现在聊天的文本字段中,发送到特定号码
Send I am interested in your car for sale to +001-(555)1234567
https://wa.me/15551234567?text=I%20am%20interested%20in%20your%20car%20for%20sale
注意:
Use: https://wa.me/15551234567
Don't use: https://wa.me/+001-(555)1234567
创建一个仅包含预填消息的链接 自动出现在聊天的文本字段中,号码将由用户选择
Send I am enquiring about the apartment listing
https://wa.me/?text=I%20am%20enquiring%20about%20the%20apartment%20listing
After clicking on the link, user will be shown a list of contacts they can send the pre-filled message to.
有关更多信息,请参阅 https://www.whatsapp.com/faq/en/general/26000030
--
P.S:旧格式(更新前)供引用
<a href="https://api.whatsapp.com/send?phone=whatsappphonenumber&text=urlencodedtext"></a>
关于html - 手机网站 "WhatsApp"发送消息到特定号码的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29218378/