Testing Webhooks in Jira Cloud

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Cloud のみ - この記事は クラウド プラットフォームのアトラシアン製品に適用されます。

   

要約

Are you uncertain if your configured Jira Webhook has been triggered? Are you testing integrations and need to verify the data sent when a Jira Webhook is triggered? This knowledge base article will guide you through these questions and more.

In this article, we will create a mock API endpoint and use it to configure a Jira Webhook. This will help us determine if the Webhook was triggered and inspect the data sent as part of the request.

診断

Diagnosing issues with Jira Webhooks often involves verifying if the Webhook has been triggered and inspecting the data sent during the trigger. Users may encounter various scenarios, such as the Webhook not reaching the destination.

原因

The root causes can vary, for example, configuration errors in the Jira Webhook settings, network issues, or authentication problems. Knowing if the data is being sent from Jira and the actual content of the data will help you continue testing and fine-tuning the rest of the configuration.

ソリューション

Creating a mock endpoint

We will use Beeceptor, an online tool that requires no downloads. Create an endpoint by entering a unique name (e.g., include your initials for uniqueness), and launch a mock server with the provided project name:

If everything is correct, you should see the following screen:

Seeing this page means your endpoint is configured and operational. Copy the provided URL (e.g., https://jira-webhook-test.free.beeceptor.com) as we will use it in a future step to configure the Jira Webhook. Keep this tab open!

This endpoint is public and shared, intended for testing purposes with test issue data only.

Configuring the Jira Webhook

  1. Log in as a user with the Administer Jira global permission.

  2. Choose  > System. Under Advanced, select WebHooks.

  3. Click on "Create a Webhook".

  4. Set the Beeceptor endpoint (https://jira-webhook-test.free.beeceptor.com in this case) in the Jira Webhook URL field:

  5. Assign a name and description that clearly describes your Jira Webhook's purpose.

  6. Select the events that will trigger this Webhook. For simplicity, we will choose Issue related events to send a request when an issue or comment is created or updated:


    You can also consider other events:

    • User related events

    • Jira configuration related events

    • Project related events

    • Jira Software related events

  7. If you need to restrict the Webhook trigger, use a proper JQL query. For this demonstration, we won’t include any JQL, so the Webhook will trigger for any issue created, updated, or any comment added or edited.

  8. Ensure to untick the Exclude body checkbox to receive a JSON payload with the data:

  9. Click Create at the bottom of the page to finalize your Webhook configuration:

Testing the Webhook

It's now time to test the Webhook!

After editing an issue for the purpose of this test, check the Beeceptor tab. You should see a new request sent to the mock endpoint. Expand the request to view details such as the AAID of the user who triggered the event (e.g., the user who edited the issue). You can also inspect headers and use the "pretty print" function to view the formatted JSON request body:

Analyzing the Request Body will help you understand the data sent with this request, which can be useful for further development and testing. By following these steps, you can successfully confirm whether a Jira Webhook was triggered and inspect the transmitted data.

最終更新日 2024 年 6 月 17 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.