1

I am making offline WhatsApp bulk SMS software using c#. I don't get WART connection code. error is connection login failed. What to do? Can anyone help me out? Reply me.As soon as possible.

My coding is as below:

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 smsdemo1;
using WhatsAppApi;

namespace smsdemo1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btn_send_Click_Click(object sender, EventArgs e)
        {

            string from = "919999999999"; //(Enter Your Mobile Number)
            string to = txt_to.Text;
            string msg = txt_msg.Text;
            MessageBox.Show("1 st test");
            WhatsApp wa = new WhatsApp(from, "Password", "nickname", false, false);
            MessageBox.Show("2 st test");
            wa.OnConnectSuccess += () =>
            {
                MessageBox.Show("3 st test");
                MessageBox.Show("Connected to WhatsApp...");

                wa.OnLoginSuccess += (phonenumber, data) =>
                {
                    MessageBox.Show("4 st test");
                    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...");
            };
            wa.Connect();
            wa.SendMessage(to, msg);
            wa.Disconnect();

        }
    }
}
cgiit
  • 11
  • 1
  • 2
    What have you tried do debug this code? What is the exact error? Are you 100% positive the login credentials are entered correctly? – rhughes Apr 09 '16 at 10:15
  • I am making sending whatsapp bulk message using c#. My code is as above. The error is, i cannot connect it to whatsapp. And when i logged in to WART whatsapp,i did not get code in my phone number. if you have any idea about sending sms to whatsapp then send me code. – cgiit Apr 09 '16 at 10:24
  • @cgiit did you manage to get this working? – Craig P Sep 26 '17 at 08:53

0 Answers0