WhatsApp c# api“登录失败”;消息

本文关键字:登录失败 消息 失败 登录 api WhatsApp | 更新日期: 2023-09-27 18:01:20

我正在使用c# API的whatsapp

,当我试图发送消息到任何号码,消息"登录失败"显示给我!!

这是我的代码

  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();

WhatsApp c# api“登录失败”;消息

https://drive.google.com/file/d/0BwBxpfm3kmmgNGtKNkRTRF9fS0k/view?pli=1使用这个DLL这为我工作,尝试使用一个新的什么应用程序没有,刚从wart注册

使用的代码是

      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");

对于所有登录失败未授权的人,我发现了问题所在。从wart获得密码后,您需要验证手机中的whatsapp。问题是,当你修改密码时,它会改变你的密码,所以不要修改。如果你想从c#发送whatsapp消息,你需要为你的whatapp加密,或者你可以得到另一个号码。所以记住不要验证!!!!