How do I trigger group membership was granted for a user - Group module I try to use group module in d8.

1. I created a new group type named test


2. I added 2 group as demo with admin is default group_membership.

3. in group 1 (name okok) I edited and added new user to group.


4. When I click the add member, the site redirect to another add form:



I enter the user as normal.
then click save button.


5. The result is User was added into that group.



So, What I wonder is how to know an user:


Was added to a group.
Was removed from a group.


Because I want to call another service every time that action/event was executed. For example, I want to log in to the watchdog like: 


"User A has been added into group X"
"User B has been remove from group Y"


Is there any way to trigger that action/event in code.

Thanks for all your helps.
as @Jaypan suggested to me,
I used hook_ENTITY_TYPE_insert()
so my code is:
function hook_group_content_insert(GroupContentInterface $group_content) {
  if ($group_content-&gt;hasField('entity_id')
    &amp;&amp; !$group_content-&gt;get('entity_id')-&gt;isEmpty()) {
    $users = $group_content-&gt;get('entity_id')-&gt;referencedEntities();
    $user = reset($users);
    if ($user instanceof UserInterface) {
      // Do your code here.
    }
  }
}