Liam Campbell

Liam Campbell

  • NA
  • 12
  • 3.4k

Using WhatsAppApi.NET how to send a message

Dec 10 2020 4:11 AM
I am using the WhatsAppApi.NET to send whats app messages however i dont know how to get a access code for my phone number as i see that https://github.com/mgp25/WART code generator no longer works
 
So is there a Free way to use this package and get a access code for my phone.
 
This is my code for the api so far for the console app C#
  1. static void Main(string[] args) {  
  2.   string password = "";  
  3.   string Nickname = "Joe";  
  4.   string Fromnumber = "121312432";  
  5.   string ToNumber = "12312434";  
  6.   string msg = "";  
  7.   WhatsApp wap = new WhatsApp(Fromnumber, password, Nickname, falsefalse);  
  8.   wap.OnConnectSuccess += () =>{  
  9.     Console.WriteLine("Connection Successfully");  
  10.     wap.OnLoginSuccess += (PhoneNumber, data) =>{  
  11.       wap.SendMessage(ToNumber, msg);  
  12.       Console.WriteLine("Message Sent!");  
  13.     };  
  14.     wap.OnLoginFailed += (data) =>{  
  15.       Console.WriteLine("Login Fail due to {0}", data);  
  16.     };  
  17.     wap.Login();  
  18.   };  
  19.   wap.OnConnectFailed += (ex) =>{  
  20.     Console.WriteLine("Connection Failed...");  
  21.   };  
  22.   Console.ReadLine();  
  23. }  

Answers (6)