Rocket.Chat.Apps-engine
Rocket.Chat.Apps-engine copied to clipboard
Add listeners for set and unset reaction
Some might want to do something when people add or remove a reaction from a message
Maybe some message_editted
hooks? We could send the changelog for the message to the app (along with the message itself, of course)
should a reaction trigger a message_edited
hook?
I also wonder about Apps permission. A permission to listen for reaction is way less intrusive than message edits.
should a reaction trigger a
message_edited
hook?
I do think they fit in the same event type.
I also wonder about Apps permission. A permission to listen for reaction is way less intrusive than message edits.
Do we want to go for that granular control over permissions, though? I think we might over-complicate things for end-users if we create a permission item for every possible variation on a point of interaction an app may have; also, that would make developers' lives harder, having to understand the definition of permissions that look similar (one example being extending a message vs destructively modifying a message IMO)
Which brings us to the question: is it time for us to start discussing permissions on the forum?
@rodrigok me and @sampaiodiego have disagreed on this matter, we need another opinion to break the tie :stuck_out_tongue:
it's possible a return with a value as an added or removed reaction example:
added reaction:
{ _id: 'CGRxi7SpCEJgEA63t',
rid: 'GENERAL',
msg: 'aaa',
ts: { '$date': 1551396092029 },
u:
{ _id: '2BQ3wWnRBh7vXGYdP',
username: 'eduardo.junior',
name: 'Eduardo Junior' },
_updatedAt: { '$date': 1551396149410 },
mentions: [],
channels: [],
reactions: {
'kind': 'reaction_added',
':thumbsup:': { usernames: [Array] } },
origin: 'rocket' } { roomParticipant: true, roomType: 'c', roomName: 'general' }
removed reaction:
{ _id: 'CGRxi7SpCEJgEA63t',
rid: 'GENERAL',
msg: 'aaa',
ts: { '$date': 1551396092029 },
u:
{ _id: '2BQ3wWnRBh7vXGYdP',
username: 'eduardo.junior',
name: 'Eduardo Junior' },
_updatedAt: { '$date': 1551396149410 },
mentions: [],
channels: [],
reactions: {
'kind': 'reaction_removed',
':thumbsup:': { usernames: [Array] } },
origin: 'rocket' } { roomParticipant: true, roomType: 'c', roomName: 'general' }
@d-gubert we might want to make something extremely simple that is like onMessageReactionAdd
and onMessageReactionRemove
that passes in the room, message, user, and reaction which was added or removed. I think it doesn't over complicate things for users. Since reactions currently don't fire a "message updated" event, then us adding this allows for developers of Apps to easily listen and only care about it. This is my opinion and probably how I would implement it, to be honest.
As it kind of flows with the "scopes" limiting and us later being able to programmatically tell what an app listens to and show that to users of the apps since they would be implementing an interface.
That would be a big improvement for building interactive applications. Dedicated events for reactions would be very helpful.