17

I want to send messages using whatsapi and this was my try

string nickname = "Test";
string sender = "xxxxxxxxxxxxxx";         
//My Phone Number tryed with 049xxxxxxxxxxxx, 0049xxxxxxxxxxxxxx, 49xxxxxxxxxxxxxxx, xxxxxxxxxxxxxx
string imei = "xxxxxxxxxxxxxxxxxxxxxxxxx";//My IMEI 
WhatsApp me = new WhatsApp(sender,imei ,nickname,true);
me.Connect();
Console.WriteLine(me.ConnectionStatus);// I get a Connection!
Console.ReadLine();
me.SendMessage("xxxxxxxxxx", "This is a Test!");// Send Message
//No Message received :(
me.Disconnect();
Console.WriteLine(me.ConnectionStatus);
Console.ReadLine();

Now where is my mistake? and how I'm doing it right?

I'm using this version: https://github.com/perezdidac/WhatsAPINet.

First I just want to send messages. When I try to get a request from the WART, I just get this message:

Could not request code using either sms or voice.
SMS: {"status":"fail","reason":"no routes","retry_after": 3600}
Voice: {"status":"fail","reason":"no routes","retry_after": 3600}
2
  • 1
    please describe more about solution . i install whatsapp in visual studio then use your code and connect disconnect but not send and i dont have any message from result of that sent like incorrect imie or number ... nothing... please help me and help this good page that you created May 8, 2015 at 15:27
  • 5
    github.com/perezdidac/WhatsAPINet. does not seem to exist anymore Dec 2, 2016 at 8:34

3 Answers 3

5
    WhatsApp wa = new WhatsApp("your number", "your password", "pankaj", 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");
    }
5
  • Pankaj, can you please tell me the number for which we request the code, must have whats app user. Feb 23, 2016 at 13:06
  • give your phone number. Feb 25, 2016 at 4:26
  • im getting auth response error , ive heard whatsapp has put a ban on this feature Apr 13, 2016 at 10:39
  • @PankajGupta is it still possible to use WhatsApp Api as i have seen some ban on it and WhatsAppApi.Register.WhatsRegisterV2.RequestCode not working.
    – chetan
    Nov 28, 2017 at 4:21
  • how to get password? Apr 19, 2019 at 18:37
3

download installer for generate password https://github.com/mgp25/WART from this link

after that pass your mobile no and password which you got. and pass user detail like his no or msg in constructor in whatsapp object.

it will work for you. try with it.

0
-8

After the connect put the command to Login. I resolved this way:

me.connect(); 
me.login(null);
2
  • Any additional information on how to do this or why this works would greatly help your answer.
    – ryanyuyu
    Mar 11, 2015 at 21:46
  • I don't know why this work, just try to use this code: me.connect(); me.login(null); Mar 12, 2015 at 15:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.