Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Kevin Mote
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2012

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

0 votes
Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2012

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 ;)

Kevin Mote
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2012

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?

Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2012

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 Sign up to answer