MrMins MrMins - 1 month ago 34
C# Question

whatsapp c# Auth response error

I'm using the last nuget version for whatsapp:
WhastApp API 1.2.2 and reading tutorials about configure my whatsapp in my application.
I'm using my localhost to test and my code is:

string from = "503XXXX";
string to = "503XXXX";
string msg = "lorem ipsum";

WhatsApp wa = new WhatsApp(from, "jd8eY3FXXXXXXXXXXXXXXXXXXX", "MrMins", true);

wa.OnConnectSuccess += () =>
{
wa.OnLoginSuccess += (phoneNumber, data) =>
{
wa.SendMessage(to, msg);
};
};

wa.OnLoginFailed += (data) =>
{
//Fail message
};

wa.Login();

wa.OnConnectFailed += (ex) =>
{
//ConnectionFailed
};

wa.Connect();
wa.SendMessage(to, msg);
wa.Disconnect();


I'm getting the error:

Auth response error


I updated my whatsapp password with WART and logged me out from my whatsapp mobile (I think is the correct behavior), but is still not working.

What is wrong with my codes?

Answer

Imagine, your code area is: 503 and your phone number is 555555555555

WhatsApp wa = new WhatsApp("503555555555555", "get the password using WART", "your nickname", false, false);
            wa.OnConnectSuccess += () =>
            {
                Response.Write("connect");
                wa.OnLoginSuccess += (phno,data) =>
                {
                    wa.SendMessage("Destinatino number (50377777777777)", "Youre custom message");
                };

                wa.OnLoginFailed += (data) =>
                {
                    Response.Write("login failed"+data);
                };
                wa.Login();
            };
            wa.OnConnectFailed += (ex) =>
                                      {
                                          Response.Write("connection failed");
                                      }
                ;

            wa.Connect();
Comments