问题
i'm using c# api for whatsapp
and when i attempt to send a message to any number , the message ""Login Failed" show up to me !!
here's my code
string to = textBox1.Text;
string mes = richTextBox1.Text;
string from = ******************";
WhatsApp wa = new WhatsApp(from, Mypass, "56mmkjkjk", true, true);
wa.OnConnectSuccess += () =>
{
Console.WriteLine("Connected");
wa.OnLoginSuccess += (phoneNumber, data) =>
{
Console.WriteLine("Connection success!");
wa.SendMessage(to, "Hello World!");
Console.WriteLine("Message sent!");
};
wa.OnLoginFailed += (data) =>
{
MessageBox.Show("Login failed: {0}", data);
};
wa.Login();
};
wa.OnConnectFailed += (ex) =>
{
Console.WriteLine("Connect failed: {0}", ex.StackTrace);
};
wa.Connect();
Console.WriteLine("END");
Console.ReadLine();
回答1:
https://drive.google.com/file/d/0BwBxpfm3kmmgNGtKNkRTRF9fS0k/view?pli=1 use this dll this worked for me , try to use a new whats app no , freshly registered from wart
code used was
WhatsApp wa = new WhatsApp(sender, password, nickname, true, true);
wa.OnConnectSuccess += () => {
Console.WriteLine("Connected");
wa.OnLoginSuccess += (phoneNumber, data) => {
Console.WriteLine("Connection success!");
wa.SendMessage(target, "testing C# Api,sent via C#");
Console.WriteLine("Message sent!");
};
wa.OnLoginFailed += (data) => {
Console.WriteLine("Login failed: {0}", data);
};
wa.Login();
};
wa.OnConnectFailed += (ex) => {
Console.WriteLine("Connect failed: {0}", ex.StackTrace);
};
wa.Connect();
Console.WriteLine("END");
回答2:
To all of you who gets Login failed Not Authorized i foun out what the problem is. After you get the password from wart you need to Varefy the whatsapp in your phone . The catch is when you varpy its is changing you password so dont varepy. if you want to send whatsapp mesages from c# you need to secrapies your whatapp or you can get another number. So remember dont Vefiy!!!!
来源:https://stackoverflow.com/questions/31254529/whatsapp-c-sharp-api-login-failed-message