convert #hashtag and @user of inbound mail to JIRA labels and watchers

I am looking for a way to have labels and watchers added to new JIRA issues created through email based on social media like @mentions and #hashtags.

The idea is that to parse email inputs (an incoming mail handler plugin/script, or ScriptRunner event Listener) for use of @userid and #hashtag.

If an @userid is found, check if user exists in directory, if so add them as a watcher.

If a #hashtag is found, add it to the labels field in if the issue.

 

1 answer

JEMH can do this with its Regexp Field Processor, If CSV is an acceptable approach for mulitple values, rather than mulitple lines, ie:

@value1,value2,value3

rather than
@value1
@value2
@value3

You'd create a  Regexp Field Processor 'Field Mapping' for the Key 'watchers'

\n@([A-Za-z0-9,]+)\n

Then, an email with payload:

some text

@user1,user2

would be extracted, and set as watchers.

Likewise, a Field mapping expression for the key 'Labels':

\n#([A-Za-z,]+)\n

Would match on XX,YY,ZZ:

some text

@user1,user2,user3
#XX,YY,ZZ

These values would then be added as labels.

Removal of these values from the comment being added is also possible, through JEMH Pre-Processing > Body Cleanup Regexps (Body Cleanup Order : After Directives)

I found a few edge-case bugs along the way proving this sceanrio, (no new lines at the end of the email on the last line) but will be fixing this up in the next build for 7.4 (JEMH-5861)

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,772 views 11 18
Join discussion

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