How to configure Keycloak to automatically set custom event listener on start up?


I would appreciate a tip or advice here. Namely, I have created a Keycloak extension (custom event listener, plugin, jar file), deployed it, and manually configured in “Events/Config” as an event listener. After that I tried it, and it works as expected.

However, I haven’t found some useful tutorial on how to configure Keycloak to automatically set the extension as event listener on the service start up (or at least a guideline for a script that would do that). Not manually configuring it, but rather automatically. Could somebody help in this regard ?
We need to prepare an installation where the listener(s) will be automatically set on startup.

Thank you,

It will depend on how you are running Keycloak (i.e. from the package, Docker, k8s, …), but you can have Keycloak import a realm from json automatically on startup. E.g. look for KEYCLOAK_IMPORT in the Keycloak docker image docs. Then, you can just add the name of your listener to the eventsListeners array:

      "eventsListeners": [

If you can tell us more about your setup, then we can probably point you in the right direction.


Thanks. This may already help. If there are issues I will get back :slightly_smiling_face: