# User Invitation after Create

**URL:** <https://forum.keycloak.org/t/user-invitation-after-create/20918>\
**Category:** Getting advice\
**Created:** [March 17, 2023, 11:57pm UTC](https://forum.keycloak.org/t/user-invitation-after-create/20918 "2023-03-17T23:57:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BradleyS](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@BradleyS](https://forum.keycloak.org/u/BradleyS)\
**Post date:** [March 17, 2023, 11:57pm UTC](https://forum.keycloak.org/t/user-invitation-after-create/20918/1 "2023-03-17T23:57:37Z")

</div>

Is there anything out of the box or a maintained user plugin to accomplish sending an invitation email after a user is created through the Admin UI?

I found a question here which has some libraries but I don’t think they are maintained: [User invitation - #2 by makayabou](http://forum.keycloak.org/t/user-invitation/2198/2)

If there doesn’t exist something is the recommended way to do this just hooking into the User Creation event such as what’s in these posts?

> [@Actions after create the user? (Registration+creation)](http://forum.keycloak.org/t/actions-after-create-the-user-registration-creation/19193/3):
>
> I have some base classes for listening to user create events if you’re willing to implement your own event listener: The example there should be easy to follow: public class MyUserAddRemove extends UserEventListenerProviderFactory { @Override public String getId() { return "ext-event-myuseraddremove"; } @Override UserChangedHandler getUserChangedHandler() { return new UserChangedHandler() { @Override void onUserAdded(KeycloakSession session, RealmModel realm, …

> [@User creation through Keycloak REST API doesn't produce REGISTER event for SPI](http://forum.keycloak.org/t/user-creation-through-keycloak-rest-api-doesnt-produce-register-event-for-spi/12333):
>
> I want to call an external REST-API, when a new user has been registered in keycloak. The REST call should create a minimal user entity in my spring backend (which has its own db). When the REST call fails, it should abort the register process, so I can’t miss register events on the spring side. What I found out was that Keycloak supports custom SPI’s, where I can listen to those kinds of events and act with custom Java code to it. Sounded like a perfect fit for my use case. But after implement…

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [March 18, 2023, 7:48am UTC](https://forum.keycloak.org/t/user-invitation-after-create/20918/2 "2023-03-18T07:48:54Z")

</div>

> [@BradleyS](#):
>
> the recommended way to do this just hooking into the User Creation event

I’m not aware of something “out of the box”, but as you say, using the event system is a way to solve this problem. The [keycloak-events](https://github.com/p2-inc/keycloak-events#user-change-listener) library user change listener is maintained and used by many.

---

<div class="post-metadata">

**Author:** ![BradleyS](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@BradleyS](https://forum.keycloak.org/u/BradleyS)\
**Post date:** [March 21, 2023, 12:15am UTC](https://forum.keycloak.org/t/user-invitation-after-create/20918/3 "2023-03-21T00:15:46Z")

</div>

Ok. Is the intent to clone [keycloak-events](https://github.com/p2-inc/keycloak-events#user-change-listener) and add more events like the example `MyUserAddRemove`, build the events jar, and deploy that to the server?

Or is the intent to clone the repository, build that jar, and deploy it to Keycloak. Then in a separate codebase we can add a dependency on this built jar and extend things like `UserEventListenerProviderFactory`?

Just trying to get a feel for how to use this vs. building a provider jar following the method here in the Keycloak Extensions Playground Github repo: [provisioning-event-listener-extension](https://github.com/thomasdarimont/keycloak-extension-playground/blob/master/provisioning-event-listener-extension/src/main/java/com/github/thomasdarimont/keycloak/provisioning/ProvisioningEventListener.java)

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [March 21, 2023, 8:46am UTC](https://forum.keycloak.org/t/user-invitation-after-create/20918/4 "2023-03-21T08:46:18Z")

</div>

You can do either of those things. If I’m already packaging another extension, I’ll just include the events jar and use it as a dependency. If it’s the only extension I’m going to use, I’ll add it to the events build and add it to the jar.
