Ej  Rodrigo

Ej Rodrigo

  • NA
  • 1
  • 717

This is my code for c# web application , pls help me ..

Jul 27 2015 12:28 AM
This code is running , but it can't  send a message in my whats app using c# asp.net web application .. 
Can anyone here help me plz ? 



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WhatsAppApi;
namespace WebApplication3
{
public partial class _Default : System.Web.UI.Page
{
protected void btnSend_Click(object sender, EventArgs e)
{
string from = "+639061714515";
string to = txtTo.Text;
string msg = txtMessage.Text;
WhatsApp wa = new WhatsApp(from, "9+gmQ0wGCCl/o1tb/RpOJqYCHgw=", "Ej", false, false);
wa.OnConnectSuccess += () =>
{
MessageBox("Connected to WhatsApp ...");
wa.OnLoginSuccess += (phoneNumber, data) =>
{
wa.SendMessage(to, msg);
MessageBox("Message Sent...");
};
wa.OnLoginFailed += (data) =>
{
MessageBox("Login Failed:");
};
wa.Login();
};
wa.OnConnectFailed += (ex) =>
{
MessageBox("Connection Failed...");
};
wa.Connect();
}
public void MessageBox(string MessageBox) {
Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message Box", "<script language='javascript'>alert('" + MessageBox + "')</script>");
}
}
}