Using JIRA Webhooks

In previous recipes, we looked at how to integrate JIRA with specific applications and platforms. In this recipe, we will look at webhooks, a different way of implementing integration with JIRA.

How to do it...

Perform the following steps to set up a webhook:

  1. Navigate to Administration | System | WebHooks.
  2. Click on the Create a WebHook button.
  3. Enter a name for the new webhook. This should clearly explain the purpose of the webhook and/or the target system. For example, WebHook for Slack #support chatroom.
  4. Enter the URL of the target system for the webhook to call. The URL should be provided by the target system.
  5. Check the Exclude details checkbox if adding data to the POST will cause errors.
  6. Enter the JQL to define the issues that will trigger the webhook, or leave it blank for all issues. It is recommended that you use JQL to restrict the scope.
  7. Select the issue events that will trigger the webhook.
  8. Click on Create to register the webhook:
How to do it...

How it works...

Webhooks follow an event-based mechanism, where the source system (in this case, JIRA) will make an HTTP POST call to all the registered webhooks when a registered event occurs. This is very similar to JIRA's internal notification system where e-mails are sent based on events.

With the event-based approach, instead of requiring the remote application to constantly poll JIRA for changes, which is both inefficient and inadequate for situations where changes need to be processed in real time, the remote application can be registered in JIRA with a webhook, and JIRA will call the application when the event occurs.

There's more...

You can also trigger webhooks from workflow post functions with the Trigger a Webhook post function. All you have to do is select the transition that will be the trigger, add the post function, and select the webhook to be triggered. This is particularly useful since the webhook configuration panel only lists some of the basic event types, but not any custom event types that are used in workflows.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset