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

wesley smith October 8, 2015

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
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 8, 2015

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 https://confluence.atlassian.com/jira/customizing-email-content-185729653.html

wesley smith October 9, 2015

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?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 9, 2015

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
TAGS
AUG Leaders

Atlassian Community Events