I write the code to send sms using whatsapp API and winform C#. I don't know what problem with it.
It has error
"Login failed not-authorized"
...but I registered in "Whatsapp registration" download from "https://github.com/mgp25/WART" and have password like image.
Here is my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WhatsAppApi;
namespace sms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btn_send_Click(object sender, EventArgs e)
{
WhatsApp wa = new WhatsApp(txt_phone.Text, txt_pass.Text, txt_name.Text, true);
wa.OnConnectSuccess+= () =>
{
txt_status.Text = "Connect...";
wa.OnLoginSuccess+= (phone, data) =>
{
txt_status.Text += "\r\nConnection success!";
wa.SendMessage(txt_to.Text, txt_message.Text);
txt_status.Text += "\r\nMessage Sent!";
};
wa.OnLoginFailed+= (data) =>
{
txt_status.Text += string.Format("\r\bLogin failed {0}", data);
};
wa.Login();
};
wa.OnConnectFailed+= (ex) =>
{
txt_status.Text += string.Format("\r\bConnect failed {0}", ex.StackTrace);
};
wa.Connect();
}
}
}