2014-11-03 107 views
-1

如何從C#Asp.net應用程序發送消息(文本,圖像,視頻)到whatsapp。如何使用C#編程發送消息到whatsapp數字

+1

你跟一個特定的問題或只是一個圖書館一個大禮包掙扎? – 2014-11-03 06:03:41

+0

這將幫助你,WhatsAPINet - https://github.com/perezdidac/WhatsAPINet – 2014-11-03 06:02:57

+0

項目github.com不再存在bro @ andrey.shedko – gumuruh 2016-04-20 15:34:50

回答

2

我找到This Link完美的解決方案。

下面的代碼(C#)我用於發送MESSAGE-

//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(); 
+0

whatsapp不提供任何公共api。使用這段代碼來做它合法嗎? – 2016-06-09 09:16:11

2

通過WhatsApp的編程方式發送大量郵件是明確反對他們的服務條款,並張貼andrey.shedko的(第三方)API的連作者不維護,或接受任何責任。在應用程序中有一個功能,可以根據需要向您實際知道的人發送儘可能多的信息 - 代之以使用它。

內的Legal部分:

(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,因此在這裏沒有迴旋的餘地。