Send WhatsApp sms

Taqi

New member
Joined
Feb 16, 2015
Messages
2
Programming Experience
5-10
Hello Everyone,
I have downloaded this whatsApp Api

Whatsapp API for .NET 15.1.9

But I don't know how to use this API to send Message to others

I tried the following code but it is throwing exception

WhatsAppApi.WhatsApp objwa = new WhatsAppApi.WhatsApp("+923422352158", "123456789012345", "Taqi",true);
objwa.OnError += new WhatsAppApi.WhatsEventBase.OnErrorDelegate(objwa_OnError);
objwa.OnConnectFailed += new WhatsAppApi.WhatsEventBase.ExceptionDelegate(objwa_OnConnectFailed);
objwa.Connect();
objwa.Login();

The Above code throw exception
Invalid length for a Base-64 char array.

Any help will be appreciated.
Thanks
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,272
Location
Sydney, Australia
Programming Experience
10+
It sounds like that API requires you to provide data in base-64 format rather than the raw text you want to send. You should read the documentation for the API more carefully to be clear about what it's expecting but I can tell you that you can convert your own text into base-64 format like this:
var originalText = "Hello World";
var binaryData = Encoding.ASCII.GetBytes(originalText);
var base64String = Convert.ToBase64String(binaryData);
 

Taqi

New member
Joined
Feb 16, 2015
Messages
2
Programming Experience
5-10
Thank you for your reply that seems to solved the issue but Im having issue with this API. No proper documentation is provided on owner site about how to use it.

I need to send msg to other member of whatsapp if you can please provide me a sample code.

Will be very Thank full.
 
Top Bottom