# Setting up Jira webhook

### Step 1: Create a new webhook in Jira

1. Log in to your Jira instance.
2. Navigate to the space you want to integrate with AppSec Portal.
3. Click on the "**Settings**" icon on the right side of the header.
4. Select "**System**" from the dropdown menu.
5. Select the "**WebHooks**" from the menu on the left side of the screen.
6. Click on the "**Create a WebHook**" button.

**For cloud Jira instance: https\://\<instance>.atlassian.net/plugins/servlet/webhooks**

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2F8MhztS9INyUBoEERqeZy%2Fimage.png?alt=media&#x26;token=ea240529-5cc8-47ff-bde9-704d1a681a74" alt=""><figcaption><p>"Create a WebHook" page</p></figcaption></figure>

### Step 2: Configure the webhook in Jira

1. Enter a name for the webhook in the "**Name**" field.
2. Enter the [webhook URL](#understanding-the-webhook-url) provided by AppSec Portal in the "**URL**" field.

The webhook URL provided is an endpoint within the AppSec Portal's API that Jira can use to send events or data.

{% hint style="info" %}
In the example below, the **URL** has several components separated by forward slashes:

* `https://<appsec-portal-host>/api/v1/jira-helper/jira-event`: This is the route for the webhook that receives the Jira event.
* `e2b7e8be-1c77-4969-9105-58e91bd311cc`: This is a *unique identifier* (token) that is associated with the specific webhook event. This identifier is used to ensure that the event is coming from a trusted source and to match the incoming event with the corresponding webhook configuration.
  {% endhint %}

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2FDOKvw5iSNWNczisLLwAG%2Fimage.png?alt=media&#x26;token=592a56d0-d969-4503-8e8a-5327fc34b190" alt=""><figcaption></figcaption></figure>

3. Select the "**Issue related events**" that will trigger the webhook:

* check the "*updated*" and "*deleted*" boxes in the "**Issue**" and "**Comment**" columns.

4. Select the scope: **all issues.**
5. Leave the "Exclude body" option unchecked.
6. Save your changes.

<details>

<summary>Example configuration</summary>

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2F5HlUy8ExI86LsKqf30vZ%2Fimage.png?alt=media&#x26;token=9d158b67-88ee-4914-a1d6-eb4c0035b33b" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary>Successfully created webhook</summary>

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2FfSLcYRuj8n5XbxpAgMC0%2Fimage.png?alt=media&#x26;token=62693ac4-c246-4607-8581-049e45d1221d" alt=""><figcaption></figcaption></figure>

</details>

### Step 3: Test the webhook

Now you can test the webhook by **adding a label** or **changing the status** of a task in Jira and see if the corresponding updates are reflected in the AppSec Portal.

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2Fr78w1BmRJQjNXMNLqPXG%2Fjira_webhook_test.gif?alt=media&#x26;token=16229062-ca5e-487b-a232-8cb4a3753f7e" alt=""><figcaption></figcaption></figure>
