'send whatsapp messages using WhatsappAPI in c#
I have installed WhatsappAPI from NuGet package manager and tried to implement code but could not register my mobile number through WART (WhatsApp Registration Tool).Its giving error LIKE {Status:"Failed",Reason:"Bad_Request"}
all the time.
I have searched a lot.But there is no any solution to this issue.
There is only tool i.e. WART for registration.
Is there any new updates OR WART is still working..??
My code is given below.
public JsonResult SendMessage(string sendTo,string message)
{
var response = false;
string from = "91XXXXXXXXXX"; //(Enter Your Mobile Number)
String password;
var res = WhatsAppApi.Register.WhatsRegisterV2.RequestCode(from, out password);
WhatsApp wa = new WhatsApp(from, password, "abc.com", false, false);
wa.OnConnectSuccess += () =>
{
wa.OnLoginSuccess += (phonenumber, data) =>
{
wa.SendMessage(sendTo, message);
response = true;
};
wa.OnLoginFailed += (data) =>
{
response = false;
};
wa.Login();
};
wa.OnConnectFailed += (Exception) =>
{
response = false;
};
return Json(response);
}
In above code m not able to generate password through WART tool or not by using api CodeRequest method.
Let me know if any updates is there.
Solution 1:[1]
Before all, you should prepare a new number that not registered in whatsapp, and then do following steps to get password.
string password ;
string number = "xxxx";
WhatsAppApi.Register.WhatsRegisterV2.RequestCode(number , out password);
//you will recieve a sms, use it to get password
string password =WhatsAppApi.Register.WhatsRegisterV2.RegisterCode(number ,"code from sms");
And the config of library is old, you should do a new configuration.
Solution 2:[2]
this WhatsApp service not working since 2017 don't loss your time .
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ahll |
Solution 2 | Aladein |