如何使用C#以编程方式将消息发送到whatsapp号码

如何从C#Asp.net应用程序向whatsapp发送消息(文本,图像,video)。

通过WhatsApp以编程方式发送批量邮件绝对违反了他们的服务条款,甚至由andrey.shedko发布的(第三方)API的作者也不会对其进行维护或对其承担任何责任。 应用程序中有一个function可以向您实际知道的人发送尽可能多的消息 – 请使用它。

在他们的法律部分:

(iii) you will not attempt to reverse engineer, alter or modify any part of the Service

C. You agree not to use or launch any automated system, including without limitation, "robots," "spiders," "offline readers," etc. or "load testers" such as wget, apache bench, mswebstress, httpload, blitz, Xcode Automator, Android Monkey, etc., that accesses the Service in a manner that sends more request messages to the WhatsApp servers in a given period of time than a human can reasonably produce in the same period by using a WhatsApp application

它们不提供公共API,所以这里没有摆动空间。

我找到了这个链接的完美解决方案。

以下代码(C#)我用于发送消息 –

 //Send ( button_click ) string from = "9199********"; string to = txtTo.Text;//Sender Mobile string msg = txtMessage.Text; WhatsApp wa = new WhatsApp(from, "BnXk*******B0=", "NickName", true, true); wa.OnConnectSuccess += () => { MessageBox.Show("Connected to whatsapp..."); wa.OnLoginSuccess += (phoneNumber, data) => { wa.SendMessage(to, msg); MessageBox.Show("Message Sent..."); }; wa.OnLoginFailed += (data) => { MessageBox.Show("Login Failed : {0}", data); }; wa.Login(); }; wa.OnConnectFailed += (ex) => { MessageBox.Show("Connection Failed..."); }; wa.Connect();