Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how to catch error messages from webhooks

Anca Cristescu
Contributor
July 23, 2024

Hi,

I'm trying to create an automation rule to get some data from one of ours servers. I managed to have a happy path - when all connections work... But from time to time "something happens" and I get an error (and I nee to have a different behavior for it).

I see in the audit log the error, but I can't get the data in webhookResponse. WebhookResponse has the values from the last (successful) call

2024-07-23 10_33_28-Automation - ABS Test.png

 

 

1 answer

0 votes
Caio Covos
Contributor
July 23, 2024

Hi @Anca Cristescu

To handle errors and different behaviors based on the response of your web request in Jira Automation, you need to set up conditional logic within your automation rule. Since Jira’s native automation capabilities might be limited in handling complex error scenarios, leveraging webhooks with proper error handling in combination with ScriptRunner might be more effective.

However, within Jira Automation itself, you can set up a basic structure to handle different responses. Here’s a high-level approach to guide you through setting this up:

Step-by-Step Guide

1. Set up your Automation Rule:

• Go to Project Settings > Automation.

• Create a new rule with the trigger that suits your needs (e.g., Issue Created, Issue Updated, Scheduled).

2. Send Web Request:

• Add the action to send a web request to your server.

• Configure the web request with the necessary details (URL, headers, etc.).

3. Check for Webhook Response:

• Add a “Log action” to log the response for debugging purposes.

• Use the “Advanced compare condition” to check the response status and body.

 
Example Rule Configuration

Trigger:

• Issue Created or any other appropriate trigger.

 Action:

 • Send Web Request to your server.

 Log Action:

 • Log action to capture the webhook response.

 Advanced Compare Condition:

 • Check the response status and handle errors.

Anca Cristescu
Contributor
July 24, 2024

Hi @Caio Covos

Thank you for your reply. This are exactly the steps that I have followed, but I can't get to capture the error message.

I have 2 requests in my automation, one to get a token and then to request I'm interested in. 

If you look in the picture, you see I actually get a 555 for my second request, but my response is 200 (from the first).

I've set the second call to wait for the response, and in this situation it 'freezes' there, no logging for second call. 

Do you have any recommendations? 

 

Thank you,

Anca

Martin Mactaggart
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 29, 2024

I get the same behaviour.  I can capture the value of {{webhookResponse}} when the automation returns 200, but if it doesn't the automation errors out on the webook.

 

I.E.: the automation terminates immediately when there is an error, so nothing further can be logged, nor can any conditional logic be applied to result.

 

This looks like a bug.  Does anyone have a solution?

Like # people like this
THIBAULT JOSSELIN January 23, 2025

Hi, I have the same thing here.

I try to insert a catch like this but I wonder that it can be done in Jira DC Automation.

Like the rule is in error dispite the catch/condition maybe we can't manage error like that. Is someone else managed that ?

 

My rule :

  1. Trigger
  2. 3 issues's condition
  3. GET Request on Confluence
  4. If Advanced condition : {{webhookResponse.status}} == 200
    1. Add commentary
  5. Else/If Advanced condition : {{webhookResponse.status}} =! 200
    1. Add commentary
    2. POST Request on Confluence

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events