devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click!
https://waha.devlike.pro/
Apache License 2.0
819 stars 249 forks source link

Receiving a webhook when a new chat is started #235

Open maggessisylvio opened 7 months ago

maggessisylvio commented 7 months ago

Hello guys,

I got a weird behavior from API when I started a new chat with some number (using my WhatsApp business account), my webhook endpoint is activated, with an empty message, as the payload below:

event: 'message', session: 'default', me: { id: '*@c.us', pushName: '**' }, payload: { id: '*', timestamp: 1700766236, from: '****@c.us', fromMe: false, to: '****@c.us', body: '',

This is normal?

Edit: to explain better, I sent a message to a number, starting a new chat, but I have not received a message at this moment.

Screenshot 2023-11-23 at 16 12 57

How my webhook was activated, I sent another message, the second one.

allburov commented 7 months ago

@maggessisylvio interesting, it doesn't happen with usual accounts (and I don't have business one to test) Could you test it with a usual account, not a business one?

Also could you update to the latest version and add DEBUG=1 environment variable and repeat the same steps and send all logs here? with debug mode in docker you'll see engines original logs, so we can debug it and understand why it happens

maggessisylvio commented 7 months ago

I'm already using the latest version. I will try with a not business account, but later, using my personal number, because I receive a lot of messages during the day hahahaha. Thank you @allburov for the answer. I managed to work around this issue by fetching the messages from the webhook endpoint that arrive with an empty body; in this case, I don't return anything.

devlikepro commented 3 weeks ago

Yes, it likely "e2e encryption" message, need to filter out it by checking isRealMessage before sending webhook

patron:PRO