Call webhook on user register?

Keith Evans Posted in Technical Support 3 years ago

Can OSSN call a webhook when a user registers? If so, how do I enable this?

I have another membership management system where I want to create a record when a user registers in OSSN, and the only way I know how is to pass the registration details via API triggered by a webhook. I just can't find a way to activate the webhook.

Replies
Indonesian Arsalan Shah Replied 3 years ago

This can be done using custom component

function my_custom_component(){
        ossn_register_callback('user', 'created', 'add_my_custom_attrs'); 
}
function add_my_custom_attrs($callback, $type, $params){
        //do not use the return in this function please
        $user = ossn_user_by_guid($params['guid']);
        if($user){
            //here you can call your API for custom CMS
            error_log($user->email);
        }
}
ossn_register_callback('ossn', 'init', 'my_custom_component');

.