Use scriptrunner to invoke Confluence template

We are evaluating scriptrunner to perform Jira/Confluence integration and I'm new to ScriptRunner/Groovy

Goal is to create a set of confluence pages when a jra issue is created

I'm able to create a basic page when jira issue is created, but I would like to create the confluence page using a confluence template

If not possible to use a confluence template then is it possible to include one HTML template in a groovy script?

Thank you for your help/input

3 answers

0 votes

Hello Jean-Michel.

I suppose that you own SR for both Confluence and JIRA. 

If that is the case, then you need the following setup:


In Confluence:

1. A REST endpoint that can be called from JIRA. This REST endpoint should take an argument, which should be the ID, or the name of the template you want to use.

This can be achieved easily with SR for JIRA, and you can find documentation on that here. The only thing you need is to find the ID of the template you want to use.


2. A Script Listener that catches onIssueCreated events and triggers the endpoint with the correct name.


The workflow would act like so:

  1. The issue in JIRA is created.
  2. The listener picks up the event, and selects a template.
  3. The listener triggers the REST endpoint in Confluence, passing as a parameter or as a JSON the name of the template to use.
  4. The rest endpoint in Confluence searches for the template ID associated with the name passed.
  5. The rest endpoint triggers the creation of the Confluence page.

If you have a more specific question please let us know.




Thank you Daniel, but as said I'm new to the scripting features, 

We are making a POC for evaluating ScriptRunner for Jira & Confluence (as I was suspecting that both plugins will be required), 

I know the ID of my template  but where can I find the documentation of the scripting elements to include (how to perform a call to the template)

I have the admins rights in both servers and I've located the Rest EndPoint as suggested but I have no idea of the kind of code I should write to follow your suggestion

Thank you for help 


0 votes

Hello Jean-Michel.

This is an easy integration test and an excellent case study.

I would however recomend that you hone your scripting skills by going through the examples that our documentation has. I will provide links for the docs of both producs, these documents have examples for what you want to achieve and you should test them in order to learn how to use SR.

I don't believe that we actually have an example of this precise integration in our SR for Jira documentation. However you can surely find an exaple on how to create a page with a template in our SR for Confluence documentation.

If not, you can refer to this very similar question  to yours.

About my last answer you can find documentation on how to set up REST endpoints for Confluence here. You can find documentation on how to set Script Listeners for Jira here

I apologise if you wanted a custom made example but building that answer from scratch would take me a really long time. If I can help you further, please let me know.



Hello Daniel,

Thank you for your reply

No worries I understand perfectly (and it was not my request to "receive" a development)

My main issue is that I have no idea of the methods & properties I should use in the script. I've already consulted all the information you've provided and I see how to connect the applications but what I should put in the script is a mistery as I don't see where to start/how to code.

As workaround for the POC I need to perform I've encoded the wiki markup corresponding to the confluence template into the script (as I don't know if it's possible to include a piece of HTML in a script) and I will perform the integration POC that way and see later how an elegant solution might be developped.

Best regards

Thank you


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,672 views 18 21
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