This is mostly configured when you're using a JIRA Server instance, but you can also do it with JIRA Cloud.
Configure locally two instances (one JIRA Software and other JIRA Service Desk) in order to configure rules to work with this.
It was possible to do that by configuring rules on Automation for JIRA on both instances. So these are the requirements for this to work:
- Automation for JIRA must be installed on both instances, the one which is sending the webhook with the JIRA issue that was created and the one which is receiving the webhook with the JIRA issue.
- You must have created the project on JIRA Software instance in order to receive the issues created dynamically.
- You'll need to create two rules, one rule into the "sending webhook" instance and other rule into the "receiving webhook" instance.
Let me jump into the rules I've configured in order to make it work:
Rule for JIRA Service Desk instance:
This rule will be responsible for sending the webhook onto the JIRA Software instance. Follow the description of each field on "Send web request" action:
- Webhook URL: This URL is retrieved when creating the rule on JIRA Software instance. Please check on the description under the "Rule for JIRA Software instance" section.
- Headers (optional): You must insert the same headers as on the screenshot ("Content-Type" and "application/json") in order for this to work correctly.
- HTTP method: It is POST because you're sending information towards the webhook URL.
- Webhook body: Select "Issue data" just to make things simpler and so you'll be sending all the issue data.
Rule for JIRA Software instance:
Screenshot 1:
Screenshot 2:
This rule will be responsible for receiving the webhook from the JIRA Service Desk instance. Follow the description of each field on both Screenshot 1 and Screenshot 2.
Fields on Screenshot 1:
- Webhook URL: This is the URL that we'll need to use on the "Webhook URL" field of the previous rule in order to direct the data towards this application. Copy and paste it carefully on the first rule.
- Execute this automation rule with:: Select "Issues provided by webhook HTTP POST body" as we are sending the issues directly through the POST body;
Fields on Screenshot 2:
- Project: Here you'll need to select the project under your JIRA Software instance that must receive all the issues that will be created from the JIRA Service Desk issues;
- Issue Type: Here you must select the issue type that the issue will be created on. In case you need to create issues from different issue types, it is possible to add some conditions with "If block condition" and make separate "Create Issue" actions for each of the issue types.
- Summary and Description: Here we must use a "Smart value" that works as a way of retrieving data that came from the "Webhook data". The logic for this specific scenario is that the "webhookData" object contains the "fields" object in which all the fields are inside. So, for the summary I've used {{webhookData.fields.summary}} and for the description I've used {{webhookData.fields.description}}. You'll need to add all the fields you want under the "Choose fields to set" option and then use the same logic to get the field values from the webhookData object.
Tips for implementation:
- In order to gather the Webhook URL, start both rules creation at the same time, so you can easily copy and paste the value;
- Start implementing this with only summary and description fields and then you can improve by searching for the fields one-by-one;
- I've added a "Log action" action on the rule for JIRA Software instance in order to understand what was inside of the "webhookData" smart value, so I was able of figuring out the pattern that we need to follow to retrieve the fields as we wanted.
22 comments