waha icon indicating copy to clipboard operation
waha copied to clipboard

Webhooks/Websockets - filter events based on custom logic (https://jsonata.org/)

Open Leonardo-Gonzaga opened this issue 1 year ago • 12 comments

I'm always frustrated when group messages appear under the "message" event, which I primarily use for direct or private conversations. It becomes confusing and requires extra filtering logic to distinguish between group chats and individual chats.

I would like the platform to introduce a new event, such as "message.group", dedicated exclusively to group messages. This way, the existing "message" event can remain focused on private or direct messages, simplifying the handling of different conversation types.

I considered manually filtering incoming messages to detect whether they come from a group or an individual. However, this approach adds complexity to the code and can lead to potential errors or overlooked cases.

Implementing a dedicated "message.group" event would help developers better organize their workflows and reduce the need for custom logic to differentiate between group and private messages.

Leonardo-Gonzaga avatar Feb 26 '25 21:02 Leonardo-Gonzaga

However, this approach adds complexity to the code

It's pretty simple, actually

if chat.id doesn't end with "@c.us" - ignore message

We'll see how many patron:PLUS and patron:PRO supporters needs the feature and prioritize it based on that! Hit +1 in the comments if you need it!

devlikepro avatar Feb 28 '25 03:02 devlikepro

Probably we could add something like https://jsonata.org/ to webhook/websocket, so you can apply any custom filters there 🤔

So you can define as many webhooks with different endpoints and the filtering logic

webhooks:
  - url: http://localhost:8000/webhooks/messages/direct
    events: [message]
   filter: "payload.from ~> /@c\.us$/"
 - url: http://localhost:8000/webhooks/messages/group
   events: [message]
   filter: "payload.from ~> /@g\.us$/"

We'll see how many patron:PLUS and patron:PRO supporters needs the feature and prioritize it based on that! Hit +1 in the comments if you need it!

devlikepro avatar Mar 27 '25 08:03 devlikepro

+1

patron:PLUS

achiya-automation avatar May 19 '25 11:05 achiya-automation

+1

patron:PLUS

dev-wabiz avatar May 22 '25 13:05 dev-wabiz

+1

rizkihidayatnet avatar May 28 '25 10:05 rizkihidayatnet

+1

patron:PLUS

higorrezend avatar Jun 04 '25 19:06 higorrezend

+1

patron:PLUS

vandyahmad24 avatar Jun 06 '25 13:06 vandyahmad24

+1

patron:PLUS

higorrezend avatar Jul 20 '25 11:07 higorrezend

+1

patron:PLUS

rafaeljuniorvip avatar Jul 20 '25 15:07 rafaeljuniorvip

+1

luizelanna avatar Jul 22 '25 13:07 luizelanna

+1

patron:PLUS

kenthugo avatar Jul 29 '25 06:07 kenthugo

+1

johndoely avatar Oct 03 '25 03:10 johndoely