waha icon indicating copy to clipboard operation
waha copied to clipboard

Receiving a webhook when a new chat is started

Open maggessisylvio opened this issue 2 years ago • 3 comments

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.

maggessisylvio avatar Nov 23 '23 19:11 maggessisylvio

@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

allburov avatar Nov 24 '23 09:11 allburov

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.

maggessisylvio avatar Nov 24 '23 13:11 maggessisylvio

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

patron:PRO

devlikepro avatar Jun 14 '24 07:06 devlikepro