Apply custom Javascript to email content as it is processed by the email handler

When one of our JIRA projects receives an email, it creates a ticket with the contents of the email.

The emails are automated from our frontend site and contain a lot of useful data. The actual emails are fairly readable. Unfortunately, the way JIRA formats the text in the ticket makes the information very difficult to read.


We have created a javascript function that takes the inputted text, parses it, and applies JIRA markup to present the data in a table (and some other stuff). 


Presently, after the ticket is created, when we go to work it, we copy the text, run it through our function, and edit the description to replace the raw text with our formatted version. This all works fine but is not very efficient.


Ideally, we would like to be able to somehow add our javascript function to the email handler so it automatically parses the text and applies the formatting upon creation of the ticket.


We are currently using JIRA 5.2. Is there any way we could achieve this?


1 answer

0 votes

Not without a lot of hacking, because javascript requires an environment to execute in.  Most of the time, this is a browser.  What you're asking for is to run javascript on the server side inside JIRA.  Which doesn't have the framework to do it.  So you'd have to hack JIRA to implement the framework, and then apply the scripts.

It would be far more easy to do the work natively.  Amend the templates that JIRA uses to generate the email, so that it generates emails in a format you prefer without having an extra layer of processing.  See

Thanks Nic. The linked topic appears to be related only to the email the Jira generates, what Im talking about is when Jira receives an email and creates a ticket from the email. Im open to using a different language to write the script if needed. Do you know of any documentation regarding applying custom processing to to ticket descriptions that are created when Jira receives an email?

I am sorry, I completely misunderstood the question. The stuff I wrote about needing to embed a framework if you want to run javascript is still broadly correct, as well as "do it natively", but the rest of my answer is junk. You've found the link to "do it natively" - writing a new email handler that can parse your incoming email in a useful way is the best approach to solve this. I'd also suggest a look at the JEMH Add-on - that's pretty good at parsing incoming email.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Statuspage

Introducing Statuspage Getting Started guides! First up: What is Statuspage?

Over the next several weeks we'll be sharing some of our Getting Started guides here in the community. Throughout this series of posts, we'd love to hear from customers and non-customers ab...

169 views 4 1
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