This event is triggered when a new message is received by your WhatsApp instance.
fromMe Field
The 'fromMe' boolean is crucial. It tells you if the message was sent by YOU (the instance) or by the CONTACT. This prevents infinite bot loops.
Real-time CRM
Use this event to push WhatsApp messages directly into your support dashboard without the user needing to refresh.
Best practices
Always check 'fromMe' before processing a message to avoid responding to your own bot's messages.
Check 'hasMedia' before attempting to download or process the 'media' object.
Use the 'source' field to identify if a message was sent via the API or manually via the phone.
Expected Responses
Explore all possible responses and outcomes from the server. We have documented each status code with data examples to make success and error handling easier.