how to send message to WhatsApp via c#? - prohacker2020 - Dec 4, 2018
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);
}
}
}
RE: how to send message to WhatsApp via c#? - ixfep - Dec 4, 2018
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);
}
}
}
RE: how to send message to WhatsApp via c#? - prohacker2020 - Dec 4, 2018
(Dec 4, 2018 12:47 PM)ixfep Wrote: API is outdated?
no still working
RE: how to send message to WhatsApp via c#? - ixfep - Dec 4, 2018
(Dec 4, 2018 12:48 PM)prohacker2020 Wrote: no still working
Link?
RE: how to send message to WhatsApp via c#? - elmagek - Dec 6, 2018
(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);
RE: how to send message to WhatsApp via c#? - ixfep - Dec 11, 2018
(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.
|