Sorry for bothering guys, I found it in the source code.
There are two hooks already:
action:group.join action:group.leaveBoth of them takes only one argument:
{ groupName: groupName, uid: uid }join: https://github.com/NodeBB/NodeBB/blob/master/src/groups.js#L633-L675
leave: https://github.com/NodeBB/NodeBB/blob/master/src/groups.js#L711-L742
Exactly what I'm looking for!
Edit:
action:groups.* hooks in the source code were renamed to
action:group.*