Rule to Call Webhook when existing user registers for a new app

Hey all,

I’m working on a Auth0 org that has several front end apps, but has shared users across those apps.

For one of the apps (let’s call it “App A”), we want to call a web hook to pass the known user info to a webhook. This article was extremely helpful for that: Post-User Registration

Unfortunately, it seems that users that already have an account with “App B” are not calling that webhook when they log into “App A” for the first time (which is the desired behavior).

Is there a similar event or flags on the context argument of the rule that I can leverage to make this happen?

Thanks!
Zack

Hi,

You can differenticate every call on the basis of application id. Every call have a application id which can be use to uniquly identify the call.

Right, but is there a way to tell from the context if that call is the first instance of the user logging into the app that corresponds to the application id?

Also, are all properties of that context argument documented somewhere?

Yes, you can find all available properties of context object below:

1 Like

Thanks! I wish that the context.stats was more fully fleshed out - not sure what all that holds, but I’m using that loginsCount to figure out if it’s the user’s first login or not (per the demo), and that’s what’s producing my issue, since the loginsCount is actually much higher than 0 if the user has logged into ‘App B’.

Any chance there’s further documention on the stats?

If you need to create a specific scanario you put any extra variable in user_metadata field and utilize that fields anywhere in rule.

1 Like

Unfortunately there isn’t…

It’s the only reference regarding stats property in context object:

if you want to explore it more I would go for console.log method.

Thanks @konrad.sopala - if I console.log inside of a rule, how can I see the output? Is there some log file that gets generated/accessible via the dashboard?

Hi,

You need to installed and extension name Real-time web-task logs. See screenshot below for further:
image

1 Like

Thanks for sharing that Rashid!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!