Are transition-triggered webhooks efficient?
Asked by Tim H_:

I was looking for a way to use [post functions to trigger automation rules](https://community.atlassian.com/t5/Jira-Service-Management/Can-I-use-a-post-function-to-trigger-an-automation-rule/qaq-p/2778650). I don't want event-based listeners but use pre-specified transitions within defined workflows. (Unfortunately, automation does not support this. See the linked discussion for details.)

As mentioned in the discussion, I found a way to do this with webhooks. Those web-hooks don't listen to events but are fired explicitly by post functions of certain transition. Technically, it works as expected and I'm happy.

However, Atlassian's document [Best practices on working with WebHooks in Jira](https://confluence.atlassian.com/jirakb/best-practices-on-working-with-webhooks-in-jira-1180143465.html) says that you actually should avoid webhooks if possible and use for example automation rules instead. They say that webhooks may slow down the system. Especially, as they have a global scope whereas automation can be done on a project level.

Unfortunately, I couldn't find any information if this is also true for my use case. I don't use event triggers for the webhooks. Instead, I fire them from pre-defined transitions.

Can anyone comment on this? Any help is greatly appreciated! I don't want to find it out the hard way \*after\* defining like 50 webhooks for certain transitions ;-)

Best regards,

Tim


Answers:
author: Florian Bonniec
body: Hi

Webhook are indeed slow on my side and can see lot of slow query in the log related to webhook that never trigger.

Could you create a custom event and trigger it in the transition instead ? Then catch the custom even with automation ?

Regards

comments: author: Tim H_
body: Hi [@Florian Bonniec](/t5/user/viewprofilepage/user-id/495589),

thank you for this suggestion. I couple of thoughts:

- Which logs do I have to look at in order to examine the webhook activity?

- Do transition-fired webhooks cause the same load that event-fired webhooks do?

- I could surely create a custom event. But aren't they actually for sending e-mails?

- Is it possible to pass an issue to the event? In the automation rule, I need to know the issue that triggered the rule. I do that by adding the issue.id to the webhook URL. I can then use it in the rule to copy values from.

Best regards,

Tim


author: Florian Bonniec
body: Actually I have a lot of JQL slow query displayed in my atlassian log and it's almost everytime related to a webhook even if the action is not related to the project the the action is triggered from.

ex \[c.a.j.p.webhooks.matcher.JqlEventMatcher_SLOW\] JQL query '{project = "ABC"} AND {key in ("DEF-123")}

For the email, it has to be configured in the Notification Scheme but you could keep the generic event and add a second one using Fire Event post-function.

In automation, select Multiple issue events trigger and select your custom event. Then you can use the usual smartvalue.

Regards


author: Florian Bonniec
body: Hi

It's indeed slow, on my side I see lot of slow query in the log that are related to webhook check that never trigger.

As you want to trigger it on a specific transition, could you create a custom event, trigger this event in the postfunction then catch it in Autoamtion ?

Regards


Tags: automation

jira-service-desk-data-center

jira-service-management

jira-service-management-data-center

jira-service-management-server

server

webhook