I use visual studio 2012 and I use whatsap api in my project (downloaded from Nuget), I already develop some code to send whatsapp message to another number, but I want to know how can i receive message from other numbers? which event should i use? and how to keep my application always listen to incoming messages.
my code to send is:
static string from = "9********";
static WhatsApp wa = new WhatsApp(from, "*******w=", "Az", false, true);
private void button1_Click(object sender, EventArgs e)
{
try
{
string to = txt_To.Text.Trim();
string msg = txt_Message.Text.Trim();
wa.OnConnectSuccess += () =>
{
MessageBox.Show("Connected Successfully");
wa.OnLoginSuccess += (phoneNumber, data) =>
{
wa.SendMessage(to, msg);
MessageBox.Show("Message Sent ...");
};
wa.OnLoginFailed += (data) =>
{
MessageBox.Show("Login Faild ...");
};
wa.Login();
};
wa.OnConnectFailed += (ex) =>
{
MessageBox.Show("Connected Faild ...");
};
wa.Connect();
wa.Login();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
My application is wondows application
any one can help me?