Incoming webhook is an incredibly useful method for triggering automation either from another automation—allowing you to control the order in which multiple automations run—or from external applications. Additionally, you can include data in the request that can be accessed in the automation via {{webhookData}}.
The format of the payload can vary depending on the source of the request. If you are sending the request through another automation, you have three options for the payload:
In most instances, you would use Custom data, allowing you to send only the necessary payload for the automation, structured like this:
{
"user": "Charlie",
"software": "{{issue.customfield_12345}}",
"role": "developer"
}
Let’s explore an example.
When you first create an automation, the incoming URL will not be generated until you have enabled or saved it.
Once enabled/saved, you will notice two key features on the trigger it has a unique URL and a secret that can be used to initiate the automation.
Now that we have the initial automation set up, let’s examine what we can do with the payload.
The first step I recommend is ensuring that the URL includes the work item key. In this example, it is part of the URL: https://api-private.atlassian.com/automation/…?issue={{issue.key}} (you can also include the key as part of the payload like this {"issues":["TEST-1"], "data": {"releaseVersion":"5.3.2"}}
). Additionally, you can verify that the payload is included by adding a condition or using the Log action option.
What if you have a more complex payload or are using one of the issue data payloads? How do you extract values nested deeper within the JSON structure? {{webhookData}} employs dot notation to access properties, such as {{webhookData.someValue.childValue}}
.
Consider a payload structured like this:
{
"user": "Charlie",
"software": {
"app": "Confluence",
"space": "IT",
"role": "admin"
},
"memberId": "123456"
}
To retrieve the space from the above payload, the smart value would appear as follows:
Putting everything together, here is the completed automation. In this scenario, this automation could be triggered from an onboarding automation that, based on the information in that ticket, calls other automations to create different tasks. For example, it could prompt the agent to add the user to the specified space in the payload.
But how do you call the automation from another automation or an external application, especially since the call now needs to include the secret?
You accomplish this by using the X-Automation-Webhook-Token header, like this:
This example shows how you can utilize smart values from the incoming webhook in Jira automation. Another potential use case could involve assigning the assignee based on the on-call schedule in JSM Operations or creating dynamic looping in automation.
Mikael Sandberg
Jira Ninja/Atlassian Wizard
Arthrex
Seattle WA
1,964 accepted answers
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
2 comments