How to Send WhatsApp Message Through Asp.Net



In this article I’m going to show you "How to Send WhatsApp Message by Using C# Coding", first design Web Application as shown in above image. Before writing code to send WhatsApp message first we need to Install WhatsApp API in our application, based on this WhatsApp API we can create object for WhatsApp. By using WhatsApp Object we can call WhatsApp Methods.

WhatsApp Methods: OnConnectSuccess, OnLoginSuccess , OnLoginFailed, OnConnectFailed
First Download WART tools from this Link WART Tools
After Download, you can run WART.exe file.

Enter your mobile number with area code and enter password which is associate with your WhatsApp account. Now, click on “Request Code” Button which will get you 4 digit confirmation code in your registration mobile number.
 Enter confirmation code and click on Confirmation code which will display password. Please Note down this generated password. This password is enter in password field at run time of project.

Now Design your Webpage like below.

Write code on “Send” button click event.
protected void BtnSEND_Click(object sender, EventArgs e)
{
   string number = "91**********"; // use number which is register from WART tool
   string to = txtTo.Text;
   string msg = txtMSG.Text;
   string password = "*****************************"; // use here password which is generated from WART tool
   WhatsApp wa = new WhatsApp(number, password, "Nickname", true); // nickname u can provide any name
            wa.OnConnectSuccess += () =>
            {
                Response.Write("connect");
                wa.OnLoginSuccess += (phoneNumber, data) =>
                {
                    Response.Write("connection successfully");
                    wa.SendMessage(to/* Number */, msg);
                    Response.Write("Sent Successfully");
                };
                wa.OnLoginFailed += (data) =>
                {
                    Response.Write("login failed" + data);
                };
                wa.Login();
            };
            wa.OnConnectFailed += (ex) =>
            {
                Response.Write("connection failed: {0}" + ex.StackTrace);
            };
            wa.Connect();
        }
Now you are ready to Send Message in Asp.Net Web Application through WhatsApp Application.

Related Posts

Previous
Next Post »

29 comments

comments
April 1, 2016 at 3:43:00 AM GMT+5:30 delete

Had issue with Login, It says unauthorized
Could you please help me with OnLoginSuccess method

Reply
avatar
April 1, 2016 at 4:04:00 AM GMT+5:30 delete

i am getting an error "Unauthorized"
Could you please help me resolving this error

Reply
avatar
April 6, 2016 at 9:33:00 AM GMT+5:30 delete

have you enter valida mobile number and password generated from WART tools and Whatsapp.dll reference in your projects.

Reply
avatar
AtomoX
April 9, 2016 at 11:15:00 AM GMT+5:30 delete

where I download Whatsapp.dll file

Reply
avatar
April 9, 2016 at 6:22:00 PM GMT+5:30 delete

Had issue with Login, It says unauthorized
Could you please help me with OnLoginSuccess method.
my email id is info.cgiit@gmail.com

Reply
avatar
Anonymous
April 22, 2016 at 7:34:00 PM GMT+5:30 delete

I alway have an error in wa.Login(), it says Auth response error. I have changed the dll and have the password from http://www.watools.es/pwd.html, because WART throws bad_token. Any ideas??

Reply
avatar
April 23, 2016 at 8:23:00 AM GMT+5:30 delete

I have same problem with Logn
Please send me source code is still working
riidhoTKJ@gmail.com

Reply
avatar
April 28, 2016 at 11:59:00 AM GMT+5:30 delete

the message is not getting sent for me

Reply
avatar
July 28, 2016 at 11:28:00 AM GMT+5:30 delete

I m get error an Un Authorized,
Can u give me the solution on my email id : dhruv4yug@gmail.com

Reply
avatar
August 14, 2016 at 8:34:00 AM GMT+5:30 delete

I am not getting the password from WART.exe. I got the error message saying that "bad-token". Can somebody plse tell me the reason for this?

Reply
avatar
Anonymous
August 16, 2016 at 8:49:00 PM GMT+5:30 delete

I m getting error from WART and also not able to get password from online URL.
Could you please help me for this, Its really urgent.

mohitj786@gmail.com

Reply
avatar
September 3, 2016 at 11:40:00 AM GMT+5:30 delete

Getting same error from wart
but if you enter number from out side of india thats working
www.metrosms.in

Reply
avatar
December 15, 2016 at 7:28:00 AM GMT+5:30 delete

Whatsapp Messenger for mobile Using the Whatsapp app, all you need is an internet connection for your phone to connect with other people

Reply
avatar
February 24, 2017 at 5:26:00 PM GMT+5:30 delete

Anybody have working dll for WhatsApp ??? A have method request Code for send sms and i get password, but Error Auth() ((((
Please contact alien-kms@mail.ru

Reply
avatar
March 5, 2017 at 2:30:00 PM GMT+5:30 delete


Send bad_token error and look for it and I do not know what it is

Reply
avatar
Anonymous
June 26, 2017 at 6:37:00 AM GMT+5:30 delete

Hi got the wa password but always authorization error, any ideas?

Reply
avatar
August 20, 2017 at 12:54:00 AM GMT+5:30 delete

I got this error {"login":"91xxxxxx8878","status":"fail","reason":"bad_token"}. If working Whatsapp registration tool or working source code you have please help me. Mail: mvinoth248@gmail.com

Reply
avatar
November 2, 2017 at 8:06:00 PM GMT+5:30 delete

will please mail me the whats app code :
mutharaju.kk@gmail.com

Reply
avatar
May 11, 2018 at 1:10:00 PM GMT+5:30 delete

the WART tool is not working..unable to get password. says old version...
what to do ?

Reply
avatar
April 2, 2020 at 10:49:00 AM GMT+5:30 delete

I got this error {"login":"91xxxxxx7781","status":"fail","reason":"old_version"}. If working Whatsapp registration tool or working source code you have please help me. Mail: mvinoth248@gmail.com

Reply
avatar
Anonymous
June 3, 2020 at 12:42:00 PM GMT+5:30 delete

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…


Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery


Reply
avatar
Anonymous
July 10, 2020 at 12:25:00 AM GMT+5:30 delete

Hello There. I found your blog using msn. This is an extremely well written article. I will be sure to bookmark it and return to read more of your useful information. Thanks for the post. I’ll certainly comeback. read

Reply
avatar
January 13, 2021 at 1:57:00 AM GMT+5:30 delete

Great Article Cloud Computing Projects

Networking Projects

Final Year Projects for CSE

JavaScript Training in Chennai

JavaScript Training in Chennai

The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

Reply
avatar
Anonymous
March 1, 2021 at 11:36:00 AM GMT+5:30 delete

Hi,
Unable to download WART Tools. so couldn't generate password.
How to get password?
Without password we cant use this code.

Reply
avatar
December 28, 2021 at 11:16:00 AM GMT+5:30 delete

WhatsApp API
We provide best WhatsApp API services across India. Send promotional Bulk SMS Marketing or buy WhatsApp Bulk Marketing Software to grow your business with Mart2global.

Reply
avatar
January 23, 2022 at 12:38:00 AM GMT+5:30 delete

Infycle Technologies in Chennai offers the leading Big Data Hadoop Training in Chennai for tech professionals and students at the best offers. In addition to the Python course, other in-demand courses such as Data Science, Big Data Selenium, Oracle, Hadoop, Java, Power BI, Tableau, Digital Marketing also will be trained with 100% practical classes. Dial 7504633633 to get more info and a free demo.

Reply
avatar

Thanks for comments.....