Incoming Webhooks example
This tutorial shows how to map the data from an incoming webhook to a Jira Issue.
In this example we will use Postman to simulate the flow.
Â
Step 1. Setup Incoming Webhooks
Navigate to Incoming Webhooks
Click New to add a new incoming webhook rule
Enter a name, our example will be Postman
For the condition add a URL condition with operation ~ meaning url must have the text in it.
The compare with string will be postman.
So whenever the URL is <baseurl>/rest/restfulintegrator/1.0/incoming/postman it will trigger this ruleWe can test this by doing a simple POST with a payload from postman
{ "name":"Summary from postman", "text":"some text for the description", "aField":"Hello From Postman" }
View the incoming log
In the log tab we can view the log details and see the incoming Body. Each of these body elements will be available in the action that receives the call.
Â
Step 2. Setup an action
Goto integrations
Click New
enter a name and select Action
Optional select a parent group to organize the action
Select template category: Jira Core Server
Select the template: Create Issue
Click Create
In the new action select an authentication to be the user that shall execute the update in Jira.
Note. this does not have to be them same used when calling the incoming rule
If you have not created a Credential for the user check out Credentials and create a basic auth user.Scroll down to the Body, here is where all magic will happen. Enter this body below, note that the project id and issue type id will be different to your Jira.
Note that we now access the json variables in the payload from postman via mustache variables named the same as the incoming body shown in the log.
{ "fields": { "project": { "id": "11800" }, "summary": "{{name}}", "issuetype": { "id": "10001" }, "reporter": { "name": "kg" }, "labels": [ "postman" ], "customfield_10201":"{{aField}}", "description":"{{text}}" } }
Step 3. Map the rule to the action
Navigate back to Incoming Webhooks
Click edit on the rule Postman that we created
in the Then box select the Postman create action that was created in step 2.
Save the rule.
Step 4 Testing the rule
Test the rule now by sending a request via postman with the body in the example in step 1.
Â
Â