Separate email templates for different "Execute Actions Email"

340 views
Skip to first unread message

Dev at Shoppr

unread,
May 30, 2020, 1:19:26 PM5/30/20
to Keycloak User
I'm using Keycloak 6.1. There are two ways users are registered in the app :

  1. Signing up by through Registration link
  2. An existing User (having certain privileges) adding a new user (by providing email, firstname and lastname of invitee) to their team
The usecase #1 is handled by enabling Registration. For usecase #2, I'm using Admin REST API POST /{realm}/users. Everything else works fine, however, I'm facing following changes with creating users through Admin REST API :
  1. When I create a user through REST API, even if the registration flow contains a "Verification Email" step by default (i.e. when user signs up by themselves, they receive a verification email), no email is sent to user, unless I explicitly call the PUT /{realm}/users/{id}/send-verify-email. The question is, why does user creation through REST API not trigger the default registration flow?
  2. I've a requirement to customize the email templates, and hence I've created customized templates for "Verify Email", "Password Reset", etc. But, I noticed that when I trigger these actions for users through Admin REST API PUT /{realm}/users/{id}/execute-actions-email, the above templates are not being used and a separate executeActions template is being used. I don't mind updating the executeActions template too, but the issue is that the same template is being used for all the actions. So the question is, how do I differentiate the emails that go out when I'm triggering a user email verification or reset password through Admin REST API ?
If the Admin REST API is not meant for the usecase that I'm using it for, I'd like to know what other options do I have to support my usecase.

Note : I'm using the REST APIs through keycloak-admin-client java package
Reply all
Reply to author
Forward
0 new messages