Azure AD B2C provides an in-built user attribute called 'User is new'. You can leverage this attribute to trigger specific actions, like sending a welcome email, upon user registration.
To achieve this:
Enable 'User is new' attribute in your application claims:
- In your Azure AD B2C policy, include the 'User is new' attribute in the claims that your application receives. This attribute will be set to
true
for new user registrations and can be utilized as a signal for triggering actions.
Set up an API Connector:
- You can use an API Connector in your B2C user flow. Specifically, configure the API Connector to be triggered 'Before including application claims in the token'. This step ensures that your custom logic (such as sending a welcome email) runs during user registration.
Use an Azure Function or other APIs:
- The API Connector can invoke an Azure Function or any custom API to execute further actions. For instance, your Azure Function can send a welcome email, log the registration, or perform other tasks.
- In your Azure Function, check the 'User is new' claim from the token, and if it’s
true
, proceed with sending the email.
This approach ensures that your action (such as sending an email) only triggers for new users during their registration.
newUser: true
in the claims if you configure it to include it. Maybe you could receive that in your app and send the email from there? – Secondguess