使用 HTML 或 JavaScript 在 Web 上的 WhatsApp 上发送消息 [英] Send message on WhatsApp on Web using HTML or JavaScript

查看:73
本文介绍了使用 HTML 或 JavaScript 在 Web 上的 WhatsApp 上发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过 whatsapp web 发送消息.

I want to send message through whatsapp web.

我正在使用以下代码但它不起作用:

I am using following code but its not working:

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

我无法看到发送此编码消息的联系人列表.我参考了:WhatsApp.comHow to use click to聊天

I am unable to see contact list to send this encoded message. I took reference from: WhatsApp.comHow to use click to chat

推荐答案

尝试将域从 wa.me 更改为 api.whatsapp.com,就像这样...

Try changing the domain from wa.me to api.whatsapp.com, like this...

https://api.whatsapp.com/send?text=text

然后你可以让它发送你想要的任何文本.您还可以选择指定电话号码...

Then you can have it send whatever text you'd like. You also have the option to specify a phone number...

https://api.whatsapp.com/send?text=text&phone=1234

不幸的是,wa.me 目前似乎仅在您指定BOTH 电话号码AND 一条消息时才有效,如下所示:

Unfortunately, it seems that wa.me currently only works when you specify BOTH a phone number AND a message, like so:

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

如果您不知道电话号码,或者不喜欢该参数,请使用 api.whatsapp.com 格式.

If you don't know the phone number, or don't like that parameter, please use the api.whatsapp.com format.

2020 年 10 月更新: wa.me 已部分修复.但是,与 api.whatsapp.com 不同的是,它不会显示网站 og:image 标签的图像预览. 所以,请继续使用 api.whatsapp.com 如上所述.

October, 2020 Update: wa.me was partially fixed. However, unlike api.whatsapp.com, it will not show an image preview of the site's og:image tags. So, keep using api.whatsapp.com as suggested above.

这篇关于使用 HTML 或 JavaScript 在 Web 上的 WhatsApp 上发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆