Whatsapp
allows you to link to a new message via
<a href="whatsapp://send?text=The text to share!" data-action="share/whatsapp/share" class="Share-link m-whatsapp">
How do I do the same thing with WeChat
?
WeChat does have a URI scheme that can be used from a browser. The scheme prefix is weixin://
.
There are a few URIs that can be used with this:
weixin://dl/stickers
weixin://dl/settings
weixin://dl/posts
weixin://dl/moments
However, in answer to your question specifically, there is one where you can chat to a contact specifically:
weixin://dl/chat?{toID}
You will need to replace {toID}
with whatever the destination user's WeChat ID is.
For reference's sake, these are the URLs that I've found this information from previously:
- https://www.quora.com/Does-WeChat-support-posting-text-to-chat-via-a-url-scheme-for-mobile
- https://www.zhihu.com/question/30616809?sort=created (will require translation, unless you are fluent in Chinese)
Weixin released an update 6.3.25 on 2016-09-05, which blocks almost all URL schemes request from non-weixin's application. Only requests from weixin's applications and some "white-listed" applications are allowed.
微信在 2016 年 9 月 5 日的 6.3.25 更新中,已经屏蔽了绝大部分外部发起的 URL Scheme 请求,只允许在微信内部或少量白名单应用中进行调用。鉴此,以下所展示的内容目前可能已经失效,本文仅供存档参考。
Translated from a mainland china's developer blog:
I'm not sure if what you wants to do is to hava a button on your view or web page, where on click it opens wechat and allows users to share the content to other people?
If it is an mobile application, you may want to have a look at wechat's offical api document.
You would first need to do some applications to wechat, then they may give you permission to use this function by providing you with an appId, you utilize this appId and implement interfaces they provide to realize sharing functions.
If you have a wechat offical acount, or you wish to show your web application pages within the browser inside the wechat app (this is my understanding), then you would want to take a look here. You would first have to register an offical account, and bind your application domain in the settings page within the account.
If you have a PC website and wish for users to share certain pages to wechat. what you can do is generate a QR code for that link, thus when users scan the code with wechat's scan function, the link would be opened within the browser inside wechat, and allowing users to use all wechat functions such as sharing.
When logging into wechat on a PC, you normally load the wechat webpage where there is a QR code. This must be scanned via the wechat client on your mobile phone. The client must be for the user attempting to contact you, it is their PC link to wechat. The user will be presented with their chat window (with their contacts listed). This is a security feature of wechat to ensure registered users only have access to the servers and to slow down trolling. The users mobile phone is the link to the system. When I go to the wechat webpage, I get a qr code and once I have scanned it using my phone app, I get my chat windows with only my contacts. You may be able to add your contact to the list but it still requires the user to have previously registered their mobile phone to the system.
来源:https://stackoverflow.com/questions/35425553/how-do-i-link-to-wechat-from-a-webpage