Skip to main content

Jira: Add agent note to a ticket when a Jira issue comment is added

in Apps
Authors list
Published: 21 Feb 2023|Last updated: 21 Feb 2023

In this article we're going to walk through the process of configuring Deskpro to add new agent notes to a ticket when a new comment is added to a linked JIRA issue. This is useful for when you want to keep Deskpro agents up-to-date with JIRA issue comments without the agent actually signing-in to Jira. You can see a full Jira Deskpro note/comment transcript right in Deskpro itself.

Install Jira AppCopy link to Install Jira App to clipboard

Firstly, you'll need to install our Jira app. Head over to the Admin section of Deskpro and navigate to Apps & Integrations > Apps > Available Apps (tab). Select the Jira app, and follow the setup instructions to install it.

image.png

Next, you'll need to link Jira issues to Deskpro tickets. Open a ticket in Deskpro and click "JIRA Issue" from the Add to Ticket menu (located at the top right of a ticket thread).

image.png
.

Now search for a Jira issue using our Jira app, select the issues you'd like to link then click "Link Issues".

image.png

Setting up an Inbound WebhookCopy link to Setting up an Inbound Webhook to clipboard

Now that we have Jira issues linked to Deskpro tickets, we can set up a webhook so we can listen for events from Jira.

Question

What is a webhook? A webhook is a special URL generated within Deskpro so that external systems can send events to Deskpro when things happen in real time. We can use webhooks to trigger actions in Deskpro, like set a ticket status or in this case, add an agent note.

Head over to Deskpro admin and navigate to Apps & Integration > Inbound Webhooks and click the " New" button at the top right of the webhooks list.

image.png

Give the new inbound webhook a name, e.g. "Jira: New agent note on issue comment" and make sure that the payload format is "Webhook accepts JSON payload". Then click "Create" at the bottom of the form.

image.png

One the new inbound webhooks has been created, immediately open it again and you'll be presented with the Webhook URL - copy this to your clipboard as we'll need it in a moment.

image.png

Configuring JiraCopy link to Configuring Jira to clipboard

Now that we have our new inbound webhook URL in Deskpro, it's time to configure Jira to use this to send events to. Head over to Jira and click the "Settings" icon at the top right of the screen. Next, click on the "System" menu item.

image.png

Navigate to Advanced > WebHooks near the bottom of the left hand menu.

image.png

Click the " Create a WebHook" button at the top right of the screen and you should be presented with the New WebHook form. Enter a name for the webhook, e.g. "Deskpro: Agent note on new issue comment" and paste the URL you copied from the Deskpro inbound webhook into the "URL" field.

image.png

Scroll down and check the "Comment > Created" checkbox so Jira will send any new issue comments to Deskpro as they're added.

image.png

Next, click "Create" at the bottom of the form and we're done configuring Jira :)

Configuring Inbound Webhook Filter, Trigger & ActionCopy link to Configuring Inbound Webhook Filter, Trigger & Action to clipboard

Now that Jira can send "new comment" events to Deskpro, we need to do something with them. In this case we're going to add a new agent note to a Deskpro ticket when we receive a comment from a linked Jira issue. To do this we're going to use a filter, trigger and action.

Question

What are trigger/actions? Triggers contain criteria we use to "observe" changes in Deskpro. In this case we're actually using the trigger to look for "comment_created" events in the event payload. Actions are the "activities" we perform when a trigger is matched. In this case we're going to create a new agent note on the linked Deskpro ticket.

Firstly, let's create a filter that finds linked Jira issues using the issue key sent in the webhook. To do this, add a filter when:

Linked JIRA Issue - Contains - twig:{{webhook.data.issue.key}}

image.png

Next we need to add a trigger to inspect the event data and only run our action if the event type is "comment_created". Give the trigger a name, e.g. "Add note" and enter the following:

Check Webhook variables - webhook.data.webhookEvent - is - comment_created

image.png

Ok, now time for the final part - telling Deskpro what we want to do when a new issue comment is created. Let's add an agent note using a template, prefixing the Jira comment with a label of "JIRA Comment [issue key]".

For the action, select "Add agent note" and either use the assigned agent or select an agent from the select box. This agent will essentially be the author of the Jira comment note in Deskpro. In the text field, let's enter our note template:

Jira Comment [{{webhook.data.issue.key}}]: {{webhook.data.comment.body}}
copy

Click save at the bottom of the screen and we're done! For reference here's a full screenshot of our webhook form:

image.png

TestingCopy link to Testing to clipboard

Now for the fun part, let's test our new inbound webhook and tigger/action. Head over to Jira and find the issue that we linked to our Deskpro ticket earlier in this article. Add a comment to it and you should see the comment appear in the Deskpro ticket thread in real time 🎉

image.png

image.png
HelpfulUnhelpful

2 of 2 people found this page helpful

next pageIntegrating Deskpro with your Slack workspace

Please log in or register to submit a comment.