whatsapp c# 身份验证响应错误
whatsapp c# Auth response error
我正在为 whatsapp 使用最新的 nuget 版本:
WhastApp API 1.2.2 并阅读有关在我的应用程序中配置我的 whatsapp 的教程。
我正在使用本地主机进行测试,我的代码是:
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();
我遇到错误:
Auth response error
我用 WART 更新了我的 whatsapp 密码并从我的 whatsapp 手机注销(我认为这是正确的行为),但仍然无法正常工作。
我的代码有什么问题?
我猜你的问题是,如果连接失败,你也尝试发送消息。试试这个而不是你的代码来发送消息:
WhatsApp wa = new WhatsApp("your number", "your password", "your nickname", false, false);
wa.OnConnectSuccess += () =>
{
Response.Write("connect");
wa.OnLoginSuccess += (phno,data) =>
{
wa.SendMessage("to", "msg");
};
wa.OnLoginFailed += (data) =>
{
Response.Write("login failed"+data);
};
wa.Login();
};
wa.OnConnectFailed+= (ex)=>
{
Response.Write("connection failed");
}
这样可以避免在连接失败时发送。
PS:如果在您的代码中连接成功,您将发送消息两次。
想象一下,您的代码区是:503,您的phone号码是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();
我正在为 whatsapp 使用最新的 nuget 版本: WhastApp API 1.2.2 并阅读有关在我的应用程序中配置我的 whatsapp 的教程。 我正在使用本地主机进行测试,我的代码是:
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();
我遇到错误:
Auth response error
我用 WART 更新了我的 whatsapp 密码并从我的 whatsapp 手机注销(我认为这是正确的行为),但仍然无法正常工作。
我的代码有什么问题?
我猜你的问题是,如果连接失败,你也尝试发送消息。试试这个而不是你的代码来发送消息:
WhatsApp wa = new WhatsApp("your number", "your password", "your nickname", false, false);
wa.OnConnectSuccess += () =>
{
Response.Write("connect");
wa.OnLoginSuccess += (phno,data) =>
{
wa.SendMessage("to", "msg");
};
wa.OnLoginFailed += (data) =>
{
Response.Write("login failed"+data);
};
wa.Login();
};
wa.OnConnectFailed+= (ex)=>
{
Response.Write("connection failed");
}
这样可以避免在连接失败时发送。
PS:如果在您的代码中连接成功,您将发送消息两次。
想象一下,您的代码区是:503,您的phone号码是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();