venomous0x / WhatsAPI

Interface to WhatsApp Messenger
2.59k stars 2.14k forks source link

WhatsApp C# SourceCode #120

Closed whatsUser closed 10 years ago

whatsUser commented 11 years ago

Hi,

as im not in the motivation of programming on whatsapp currently, ill share my project with the community. Hope someone will make a usable App out of it, as the backend is already working.

Anyone can change code or copy code from it or do what ever he wants, as im not the founder of the idea "whatsapp" and its implementation and so want no credits.

http://www21.zippyshare.com/v/23668176/file.html

Have fun and please contribute your success with the world

hermanho commented 11 years ago

Dear whatsUser,

I suggest you can create a new repositories at github for your source and maintence easily

perezdidac commented 11 years ago

I have created one in https://github.com/perezdidac/WhatsAPINet

I will upload everything during this weekend and you will be invited to contribute and help improving the project that whatsUser started.

zstars commented 11 years ago

Looks nice, you should indeed upload everything to github

sasham5 commented 11 years ago

When I run WhatsAppPort proj, I can log in and send messages fine, but I am getting "Nullable object must have a value" in public FMessage.Key Key() { return new FMessage.Key(this.remote_jid, this.from_me.Value, this.id); } called from WhatsAppApi.Response.MessageRecvResponse.TypeChat() when it is receiving a message sent to it. Any ideas? Thanks.

ghost commented 11 years ago

Hi,

thats because WhatsappPort, which is the Frontend of the App, isnt fully done. If you wanna test texting you should use the WhatsTest proj and you need programming skills to make it work. In the current edition special characters like öäü dont work and are sent int the wrong encoding.

After testing im seein the error.. gonna debug n look for a solution

EDIT: Fixed the problem, but cant commit as im not authorized.

EDIT2: Commited the fix and pulled a request

perezdidac commented 11 years ago

Dear all,

The C# API is available for downloading at: https://github.com/perezdidac/WhatsAPINet/

kingk110 commented 11 years ago

i am using this api in a console application that send msgs can anyone help me plz i added all classes and source file that will be used and and write this main function: static void Main(string[] args) { if (!CheckLogin("phone num", "pass")) { Console.WriteLine("Login failed"); } else Console.WriteLine("login Successfull"); WhatsApp ob = new WhatsApp("phone num", "password", "nickname"); ob.Connect(); ob.Login(); ob.Message("961**", "test"); Console.ReadLine();

    }
saptanhsgu commented 11 years ago

Hi,

I am planning to do some integration with WhatsApp in my one of of the application. Can i take some part of you codes and use them as a start up. Is there any legal issue.

shirioko commented 11 years ago

WhatsApi uses the MIT licence: http://en.wikipedia.org/wiki/MIT_License

So you are free to do whatever you want with it as long as you include a copy of the MIT Licence

goes off to quickly add one to his repositories

eitangot commented 10 years ago

Hi,

Really great project. I am trying to run the "WhatsTest" project and i fail the "wa.Connect();" any idea how I can fix this?

shirioko commented 10 years ago

Wrong GitHub project? https://github.com/perezdidac/WhatsAPINet

eitangot commented 10 years ago

thanks

rnieves commented 10 years ago

I would like to use and integrate this solution, unfortunately I can not find the form for password loguearme who can provide me?

string password = "K / 1 ****** yeix87Q =" ;/ / password v2

My gratitude and I hope to help with the development of this library

shirioko commented 10 years ago

Passwords are handed out by the server: https://github.com/shirioko/WhatsAPI/wiki/WhatsApp-Registration-Flow

rnieves commented 10 years ago

Thnks.

rnieves commented 10 years ago

I have problems with this nickname where I get it because "WhatsApiNet" gives me UNAUTHORIZED

fredilopez commented 10 years ago

necesito ayuda para generar el registro para poder usar las api

jesussales commented 10 years ago

Descarga wart y hazlo a través de ella es el método más fácil y más estable El 29/07/2014 21:10, "fredilopez" notifications@github.com escribió:

necesito ayuda para generar el registro para poder usar las api

— Reply to this email directly or view it on GitHub https://github.com/venomous0x/WhatsAPI/issues/120#issuecomment-50523494.

mgp25 commented 10 years ago

@fredilopez te recomiendo echar un ojo a la API y generarlo desde ahi, si lo que quieres es ir aprendiendo y eso... Sino como bien dice @jesussales descarga WART de @shirioko. Tambien si no te aclaras bien con el ingles, tengo una repo en mi perfil con soporte y dudas, todo actualizado y con muchas herramientas para el aprendizaje

shirioko commented 10 years ago

dafuq

mgp25 commented 10 years ago

@shirioko <3

pareta2 commented 10 years ago

Hello Can any one help me

How can i verify a number is on whatsapp or not using this Application. Suppose if i enter dummy number and then a real number.

Actually I do have list of thousands of number and i want to extract whatsapp numbers..Please tell me how can i do that.

mgp25 commented 10 years ago

@pareta2 This has been already answered, anyway if you need further support, contact me via email you can find it in my profile page.

pareta2 commented 10 years ago

whats your email id mine is shubhampareta@hotmail.com

Please share me the link where it has been answered..I cannot find it.

mgp25 commented 10 years ago

Use the search bar at the top of the page. My mail its on my profile page in github, just click on my username.

pareta2 commented 10 years ago

please drop me an email on shubhampareta@hotmail.com

shirioko commented 10 years ago

1) this is not an application, this is an API 2) this has been asked and answered many times 3) use my program WhatsApiNet-SyncUtil

zainsheikh commented 10 years ago

Hi, I am facing a problem when sending an image using the method WhatSocket.Instance.SendMessageImage(GroupID, Bytearray, WhatsAppApi.ApiBase.ImageType.PNG)

Image used is attached.

I am using the following code to convert the image to bytes array

public static byte[] ImageToByteArray(string imagefilePath) { try { System.Drawing.Image image = System.Drawing.Image.FromFile(imagefilePath); byte[] imageByte = ImageToByteArraybyImageConverter(image); return imageByte; } catch (Exception e) { return null; } }

    private static byte[] ImageToByteArraybyImageConverter(System.Drawing.Image image)
    {
        try
        {
            ImageConverter imageConverter = new ImageConverter();
            byte[] imageByte = (byte[])imageConverter.ConvertTo(image, typeof(byte[]));
            return imageByte;
        }
        catch (Exception e)
        {
            return null;
        }
    }

An exception is returned when the line WhatSocket.Instance.PollMessages() is executed in ProcessMessages() method. Exception returned is

BinTreeNodeReader->readListSize: Invalid token 19 at WhatsAppApi.WhatsSendBase.processInboundData(Byte[] msgdata, Boolean autoReceipt) at WhatsAppApi.WhatsSendBase.pollMessage(Boolean autoReceipt) at WhatsAppApi.WhatsSendBase.PollMessages(Boolean autoReceipt) at WhatsAppMessenger.WhatsAppClient.ProcessMessages(Object sender, DoWorkEventArgs args) in "process messages"

Also whatsapp gets disconnected after sendmessageimage is called.

I have also tried using .jpg image but the image is still not sent successfully.

download

shirioko commented 10 years ago

Use MemoryStream

byte[] imageBytes = null;
using (MemoryStream ms = new MemoryStream())
{
    using (Bitmap b = new Bitmap(image))
    {
        b.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
    }
    imageBytes = ms.ToArray();
}
mohsenfathi commented 10 years ago

why my post do not show or deleting ????

shirioko commented 10 years ago

I'm deleting them because 1) you're obnoxious 2) this project has nothing to do with Viber

mohsenfathi commented 10 years ago

are you sure ???? see this page : http://info.netsc.ir/viber/ they write this application .. !!!! and why i am obnoxious ???

shirioko commented 10 years ago

You're obnoxious because you come in here demanding source code for some Viber project and finish every sentence with ????? or !!!!!!!

And the link you posted has absolutely zero to do with me, venomous0x or WhatsAPI, so I'm not sure how you made that connection.

mohsenfathi commented 10 years ago

i can't speak English well . so i can't understanding what are you say exactly . ؟؟؟؟؟؟ OR !!!!!!! is my habit . excuse . OK ... Bye

zainsheikh commented 10 years ago

Hi shirioko

Thank u for such a quick reply. I really appreciate that.

I am still not able to send message successfully. This time the code gets stuck on this.pollmessage() in the UploadFile() method. It took almost 7 mins to get a return value from this method. The problem is that whatsapp client gets disconnected after 5 mins when there is no activity done. So when it tries to send a message after the file has been uploaded, it cant send it as the client has already been disconnected.

Is there a method by which I can increase the timeout of the whatsapp client so it does not get disconnected after the timeout?

Also I know that I would be asking for much more than I should but it would be great if u include the method of sendmessageimage() in your existing test application so that I can see how it is done perfectly.

zainsheikh commented 10 years ago

Hi shirioko

Can i please have a feedback on the above posted query?

shirioko commented 10 years ago
protected static WhatsApp Instance;

private static void Main(string[] args)
{
    ...
    Instance = new WhatsApp(sender, password, nickname, true);
    ...
    Thread t = new Thread(new ThreadStart(KeepAlive));
    t.IsBackground = true;
    t.Start();
}

protected static void KeepAlive()
{
    while (true)
    {
        Thread.Sleep(90000);
        Instance.SendGetPrivacySettings();
    }
}
bekeer020 commented 10 years ago

Dear shirioko I download your project https://github.com/shirioko/WhatsAPINet

but after login successfully show me in whatsup in my mobile the status is connected but after around 4 or 5 minutes its disappear that means disconnect how i can let the program always connected
can you help me Plz?

zainsheikh commented 10 years ago

Hi bekeer020, The code written in the last comment of shirioko helped me in solving this problem. Create a method to keep a background thread running which keeps calling an event of whatsapp and keeps it alive. Make sure that u have the Thread.Sleep(not more than 240000). Also make sure that u subscribe to the ondisconnect event of whatsapp. Once this event is fired, call the checklogin function again and create new instance of whatsapp socket followed by connect and login And finally dont forget to resubcribe to all the events of whatsapp again.

Hopefully this will help u solve ur problems

bekeer020 commented 10 years ago

Dear zainsheikh can you give me your email please?

zainsheikh commented 10 years ago

zainahmed@my.web.pk

beljk commented 9 years ago

Sir ... how to register .. i can't login

amanssit commented 9 years ago

hello friends i am facing problem when i am sending message

on localhost its working fine but after uploading my asp.net website on godaddy server messaging not working even on sever its not login my whatsapp

plz help me friends thanks in advance friends plz n (amanssit@gmail.com)

beljk commented 9 years ago

WART app doesn't work ... only one register and when try with another number doesn't work ..... and when login can't to login >> whats is problem .. my friend give me number with password and login oki but when using WART app to register .. i can't only Error message

mgp25 commented 9 years ago

You can use an easy script i made to register numbers. We are giving support and updating the API here:

https://github.com/mgp25/WhatsAPI-Official

You will find the register tool in the /examples folder, the file is called "registerTool.php". Everything is explained in the wiki too.

Regards

beljk commented 9 years ago

I'm didn't work with php .. i'm .Net developer .

amanssit commented 9 years ago

Hello After sending 10 message to diffent numbers , my number got block ,can u help me how to solve this problem

mgp25 commented 9 years ago

@amanssit if you send messages to semi-random users without respecting terms, WhatsApp blocks your number

For more doubts: https://github.com/mgp25/WhatsAPI-Official

mohammedkarman commented 9 years ago

hello all, how can i get my whatsupp users from contact book using c#?

amanssit commented 9 years ago

hello sir

thank you sir for replying me , how can i solve this problem please help me out sir

On Wed, Oct 29, 2014 at 4:58 AM, mohammedkarman notifications@github.com wrote:

hello all, how can i get my whatsupp users from contact book using c#?

— Reply to this email directly or view it on GitHub https://github.com/venomous0x/WhatsAPI/issues/120#issuecomment-60849862.