Webhooks/Websockets - filter events based on custom logic (https://jsonata.org/)
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.
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 and
supporters needs the feature and prioritize it based on that!
Hit +1 in the comments if you need it!
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 and
supporters needs the feature and prioritize it based on that!
Hit +1 in the comments if you need it!
+1
+1
+1