Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

how to send message to WhatsApp via c#?

1.create a new Windows Form Application in Visual Studio
2.in the form add two textboxes with these names: txt_msg and txt_to and add a button
3. in references search whatsapp and add it
4. use this code below:

Code
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;
namespace Send_WhatsApp_Message_Using_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string From = "phone number";
            //send to
            string To = txt_To.Text;
            //your message
            string Msg = txt_Msg.Text;
            WhatsAppApi.WhatsApp wa = new WhatsAppApi.WhatsApp(From, "generated password", "Display name", false, false);
            wa.OnConnectSuccess += () =>
                {
                    MessageBox.Show("connected...");
                    wa.OnLoginSuccess += (phoneNumber, data) =>
                    {
                        MessageBox.Show("your message has been sent");
                    };
                    wa.OnLoginFailed += (data) =>
                   {
                       MessageBox.Show("error" + data);
                   };
                    wa.Login();
                };
            wa.OnConnectFailed += (ex) =>
            {
                MessageBox.Show("connection timeout");
            };
            wa.Connect();
            wa.SendMessage(To, Msg);
        }
    }
}
API is outdated?

(Dec 4, 2018 12:34 PM)prohacker2020 Wrote:  1.create a new Windows Form Application in Visual Studio
2.in the form add two textboxes with these names: txt_msg and txt_to and add a button
3. in references search whatsapp and add it
4. use this code below:

Code
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;
namespace Send_WhatsApp_Message_Using_CSharp
{
   public partial class Form1 : Form
   {
       public Form1()
       {
           InitializeComponent();
       }
       private void button1_Click(object sender, EventArgs e)
       {
           string From = "phone number";
           //send to
           string To = txt_To.Text;
           //your message
           string Msg = txt_Msg.Text;
           WhatsAppApi.WhatsApp wa = new WhatsAppApi.WhatsApp(From, "generated password", "Display name", false, false);
           wa.OnConnectSuccess += () =>
               {
                   MessageBox.Show("connected...");
                   wa.OnLoginSuccess += (phoneNumber, data) =>
                   {
                       MessageBox.Show("your message has been sent");
                   };
                   wa.OnLoginFailed += (data) =>
                  {
                      MessageBox.Show("error" + data);
                  };
                   wa.Login();
               };
           wa.OnConnectFailed += (ex) =>
           {
               MessageBox.Show("connection timeout");
           };
           wa.Connect();
           wa.SendMessage(To, Msg);
       }
   }
}
(Dec 4, 2018 12:47 PM)ixfep Wrote:  API is outdated?

no still working
(Dec 4, 2018 12:48 PM)prohacker2020 Wrote:  no still working

Link?
(Dec 4, 2018 12:50 PM)ixfep Wrote:  Link?

how this?!!
i think it's stoped

and how to login first before send msg by this code
WhatsAppApi.WhatsApp wa = new WhatsAppApi.WhatsApp(From, "generated password", "Display name", false, false);
(Dec 6, 2018 08:53 AM)elmagek Wrote:  how this?!!
i think it's stoped

and how to login first before send msg by this code
WhatsAppApi.WhatsApp wa = new WhatsAppApi.WhatsApp(From, "generated password", "Display name", false, false);

The project is already dead. Nothing api projects more work... you could try JavaScript-Version.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by SmokyOct 28, 2022 11:17 AM 3 249 Oct 28, 2022 11:17 AM
Last Post: m0rty.
[C#] by assashakanAug 28, 2017 08:46 AM 4 318 Aug 28, 2017 08:46 AM
Last Post: assashakan
[Python] by ASiiMOMay 27, 2017 07:30 AM 4 251 May 27, 2017 07:30 AM
Last Post: ASiiMO