How to create an email notification when new user signs in?

I want to receive an email whenever a new user signs up, or a new user account is created. A request for this functionality was posted nearly 10 years ago(!), but so far it remains unresolved. That original request ticket includes a comment describing a "workaround" which is certainly tantalizing, but the page linked to leaves more questions than it answers. What I really need is a step-by-step explanation of how to set this up. I'm particularly puzzled with the distinction between Events and Listeners. Some of my questions are:

  • Do I need to add a Custom Event? (This seems fairly easy at first, but the final step involves templates and workflows and post functions. The workflow webpage alone is a mile long; Do I really need to understand all that just for new user notifications?)
  • And if I have to add a custom event, does that mean I have to first Create a Custom Event? (requires xml editting and a JIRA restart).
  • Do I need to create a custom Event Listener? (hard! requires plugin projects and jar files, etc)
  • The JIRA documentation describes the API for a so-called "UserEventListener", but the "Add Listener" dialog doesn't list it under the "Built-in Listeners", so how do I add it or make use of it?
  • Or, alternatively, should I edit the "MailListener". If so, how?

I'm sure my answer is probably buried in one of those pages I have linked to, but there is so much information out there that I've just gotten lost in it all. Is there anyone who has already gone down this path who could kindly boil this down for me?

1 answer

Hi Kevin,

To be clear, no event is fired relating to user logins, therefore you cannot create or add a listener for this. The related issue just says that you can hook into some specific UserEvents. To do this you would have to implement a ServetFilterPluginModule to filter the actual login (this could almost be a standalone plugin in its own right). From there you can do what you want, either send an email, or (better) fire a custom event, then have a listener catch that and generate the email. Hmmm. Added to my JEMH todo list.

For new user Sign Ups (not quite the topic ) yes, you can :

1) create a plugin that implements the UserEventListener

2) from the listener, send an email.

The tutorial for the IssueEvent listener should be followed, with the minor change that you are listening for UserEvents, I think (ie I havent coded this) just modifying the example to the following is whats needed, you just then need to send some mail:

@EventListener  public void onUserEvent(UserEvent userEvent) {

jamie-echlin can I'm sure suggest a scripted way of implementing this ;)

Thanks, but I'm not interested in user logins, but in userCreated events and userSignup events. How do I make JIRA listen for them and send notifications when they are triggered? Does your advice for a plugin module still apply? That seems like a fairly heavy-handed approach. Is there nothing simpler?

You have to either write a plugin or write a script, so it depends a lot on available skills. there isn't a plugin that does this, yet..

Suggest an answer

Log in or Join to answer
Community showcase
Jason Wong
Published yesterday in Agility Beta

Welcome to agility

Every team in the world is unique, and so   Atlassian believes   that each and every team's best way of working  needs to  be molded to their unique circumstances  – ...

239 views 5 14
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot