Ejemplo n.º 1
0
        public static string ISendMessage(string to, string txt)
        {
            var tmpMessage = new FMessage(GetJID(to), true)
            {
                data = txt
            };

            WhatsAppApi.WhatsApp wa = new WhatsAppApi.WhatsApp();
            wa.SendMessage(tmpMessage, wa.hidden);
            return(tmpMessage.identifier_key.ToString());
        }
Ejemplo n.º 2
0
        protected void SendMessaggioWhatsApp(string messaggio)
        {
            WhatsAppApi.WhatsApp wa = new WhatsAppApi.WhatsApp("+39 3492240520", "", "GratisForGratis", false, false);
            wa.OnConnectSuccess += () =>
            {
                Response.Write("connect");
                wa.OnLoginSuccess += (phno, data) =>
                {
                    wa.SendMessage("+39 3492240520", messaggio);
                };

                wa.OnLoginFailed += (data) =>
                {
                    Response.Write("login failed" + data);
                };
                wa.Login();
            };
            wa.OnConnectFailed += (ex) =>
            {
                Response.Write("connection failed");
            };
        }