Create
cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,739
Community Members
 
Community Events
176
Community Groups

πŸͺ„ Automate your Confluence documentation

The automation team recently released a new trigger: Project created. Which made me think: what if we could automatically create a new Confluence space when a new Jira project is created? It would save us a lot of time and ensure we always have a Confluence space associated to a Jira project. Let's do it!

 

πŸ”Ž Gather your API information

We will use Confluence Cloud API to automatically create a new space. Go here to create a new API token:

api-token.png

Save the generated token in a safe place.

 

🚧 Build the rule

Select the Project created trigger:

project-created.png

You can restrict the trigger to a specific project type - you may want the Confluence space to be created only for Software projects.

Then add a Send web request action. This can be a bit complicated, let me break it down for you:

  • Webhook URL:
https://yoursitename.atlassian.net/wiki/rest/api/space
  • Header:
    • Name: Authorization
    • Value: Basic followed by "email:apitoken" encoded in base64

Go to base64encode.org to generate your header value. Just type email:apitoken and hit encode. If my email is manon@gmail.com and my API token is 12345, here is how it should look like:

api-header.png

  • HTTP method: POST
  • Webhook body: Custom data
{
"key": "{{project.key}}",
"name": "{{project.name}}",
"description": {
"plain": {
"value": "This space is linked to Jira project {{project.key}}.",
"representation": "plain"}
}
}

We are using a bunch of smart values in the custom data so that, in both our new Jira project and new Confluence space, we have the same key and name. Read more here about smart values you can use.

Almost there! Here is the final Send web request action:

action.png

🚨 Improve your audit log

This is optional but I like to add log actions. It will come in handy if you need to debug your rule:

debug.png

You can use the following smart values:

{{webhookResponse.status}}
Space {{webhookResponse.body.key}} successfully created
Uh oh, something went wrong. Error {{webhook.Response.status}}

Note: if you do add these actions, remember to enable "Delay execution of subsequent rule actions until we've received a response for this webhook" in the Send web request action.

β›± Sit back and relax

You did it! A new Confluence space will now be automatically created whenever you create a new Jira project:

success.png

5 comments

Great use of the Confluence API to automate Space creation ! Thanks @Manon Soubies-Camy _Modus Create_  

Jack Brickey Community Leader Aug 07, 2021

@Manon Soubies-Camy _Modus Create_ , another awesome use of automation. Thanks for sharing.

Like β€’ # people like this

Very useful automation! This will come in handy! Great work @Manon Soubies-Camy _Modus Create_!

Hi @Manon Soubies-Camy _Modus Create_ 

Great work and helpful article ! Thx.

However, seems to be basic authentication is now deprecated in cloud.

Link doesn't work and I can't find the right article. Anyone have it ? 

Thx,

Hi @Manon Soubies-Camy _Modus Create_ 

Will the same configuration works in Data center as well? Can you please let me know.

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events