1 follower Follow

webhook of type space member.remove not working in switch block


Im am working on a script that creates a logfile of members beeing added an removed from at certain workspace.

I have created a webhook on type space and the code should react and do something when member is added or removed.

It works when I add a new member but it also reads the next lines of code in the 2. Case and sends me an email from that to.

When I try to remove a member. Nothing happens. What am I doing wrong?  Here the code:


try {
    switch ($_POST['type']) {
                case 'hook.verify':
    // Validate the webhook
                PodioHook::validate($_POST['hook_id'], array('code' => $_POST['code']));
             case 'member.add':
                $newSpaceMember = PodioSpaceMember::get( $SPACE_ID,$_POST['user_id']);
                $date= date_create();
                mail($email,"Ny bruger er tilføjet",$newSpaceMember->profile->name);
             case 'member.remove':
                $date= date_create();
                $formatet_date = date_format($date,"d/m/Y");
                $removedSpaceMember = PodioSpaceMember::get( $SPACE_ID, $_POST['user_id']);
                mail("","Member is removede","der er blevet lavet en ny status");
   catch (PodioError $e) {
    echo $e->body['error_description'];


Søren Nørup

Søren Nørup

Please sign in to leave a comment.