html - 手机网站 "WhatsApp"发送消息到特定号码的按钮

标签 html mobile-website whatsapp

可以自定义移动网站,以允许用户将 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.


示例:

  1. 创建一个包含预填信息的链接 自动出现在聊天的文本字段中,发送到特定号码

    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

  2. 创建一个仅包含预填消息的链接 自动出现在聊天的文本字段中,号码将由用户选择

    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/

相关文章:

javascript - 使用 Whatsapp API 进行 Chrome 扩展程序开发

javascript - 如何使用 materialize.css 创建 slider

javascript - 将基本的Python游戏嵌入到网络中?

html - 悬停触摸屏

android - Whatsapp 如何立即保存聊天记录,而不是备份

android - Whatsapp错误音频/声音setResult Intent

html - 为什么 min-height :100% not work since declaring a doctype?

html - 如何在odoo报告中添加一个字段?

css - 使用尽可能少的 CSS 类是否会带来很大的性能提升?

css - 我如何创建一个适用于 Android 和 iOS 浏览器的 CSS x2 视网膜尺寸