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

  1. Navigate to Incoming Webhooks

  2. Click New to add a new incoming webhook rule

  3. Enter a name, our example will be Postman

  4. For the condition add a URL condition with operation ~ meaning url must have the text in it.

  5. The compare with string will be postman.
    So whenever the URL is <baseurl>/rest/restfulintegrator/1.0/incoming/postman it will trigger this rule

  6. We 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" }
  7. 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

  1. Goto integrations

  2. Click New

  3. enter a name and select Action

  4. Optional select a parent group to organize the action

  5. Select template category: Jira Core Server

  6. Select the template: Create Issue

  7. Click Create

  8. 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.

  9. 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.

  10. 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

  1. Navigate back to Incoming Webhooks

  2. Click edit on the rule Postman that we created

  3. in the Then box select the Postman create action that was created in step 2.

  4. 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.

 

Â