locked
message not shown in whatsapp? RRS feed

  • Question

  • User-1647172364 posted

    Hlo Professionals!

    I want to send message from c# to whatsapp mobile no. but message can't be  send.

    Here is my code 

    Please execute it.

     

    cs
    
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using WindowsFormsApp2;
    
    using WhatsAppApi;
    namespace WindowsFormsApp2
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                string from = "917009390171"; //(Enter Your Mobile Number)
                string to = txt_to.Text;
                string msg = txt_msg.Text;
                WhatsApp wa = new WhatsApp(from, "%e3%27%5cb%eb%ffx%22%2c%28%0er%7c%87%5d%d6%c5k%7f%e1", "NickName", false, false);
                wa.OnConnectSuccess += () =>
                {
                    MessageBox.Show("Connected to WhatsApp...");
                    wa.OnLoginSuccess += (phonenumber, data) =>
                    {
                        wa.SendMessage(to, msg);
                        MessageBox.Show("Message Sent...");
                    };
                    wa.OnLoginFailed += (data) =>
                    {
                        MessageBox.Show("Login Failed : {0} : ", data);
                    };
    
                    wa.Login();
                };
                wa.OnConnectFailed += (Exception) =>
                {
                    MessageBox.Show("Connection Failed...");
                };
            }
        }
    }
            
    

    Tuesday, July 21, 2020 8:52 AM

All replies

  • User-939850651 posted

    Hi sanam13,

    I want to send message from c# to whatsapp mobile

    To send message to WhatsApp using C#, if possible, you could try "Twilio API for WhatsApp C#/.NET ".

    Best regards,

    Xudong Peng

    Wednesday, July 22, 2020 2:38 AM