sanderdriesen / WhatsAPINet

A .NET WhatsApp API
32 stars 48 forks source link

Receiving messages isn't working #8

Closed dholakiyaankit closed 9 years ago

dholakiyaankit commented 9 years ago

Hey, I just see that receiving messages isn't working....is this not possible? or should I invoke some method to retrieve it?

ccejas commented 9 years ago

Hi! In the project WhatsTest you have an example that explain how to use

sanderdriesen commented 9 years ago

@dholakiyaankit can you confirm whether the comment of @ccejas helped you out with receiving images?

dholakiyaankit commented 9 years ago

@sanderdriesen not really.

sanderdriesen commented 9 years ago

Can you share your code and some more information about what you tried so we can help you out?

dholakiyaankit commented 9 years ago

@sanderdriesen actually I don't have it. I tried this demo. it is working fine for sending messages. but I realized there is no code for receiving messages. can you show me some code/logic/demo for this?

sanderdriesen commented 9 years ago

There are some events available in the WhatsApp class indicating that a message is received. You can use it like this:

private void Init()
{
   _wa = new WhatsApp(MobileNumber, _password, Nickname, true);
   _wa.OnGetMessage += OnGetMessage;
}

private void OnGetMessage(ProtocolTreeNode messagenode, string @from, string id, string name, string message, bool receipt_sent)
{

}

Is this what you was looking for?

dholakiyaankit commented 9 years ago

@sanderdriesen yeah actually. Thanks for the help. I will checkout later and will let you know.