Is there a way to not fire a registered webhook for a specific API requests?

vahe.g November 19, 2020

Let's say I have a registered and configured webhook for task creation event. So each time user creates a task in Jira, that webhook will be fired, all is fine. But what if I want to execute a task creation request through the Jira REST API and I don't want the webhook to be fired in that case? 

Is there some request header or some URL parameter which I can specify in the API request and which will instruct Jira to not fire a webhook as a result of that API request?

P.S. For example Teamwork has a way of doing this by adding ?fireWebhook=false to any API request: https://developer.teamwork.com/guides/webhooks/

So what I'm looking for is an analog to that.

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 23, 2020

Hi,

I see that you are looking for a means to create issues via the REST API, but have the option to not trigger any webhook that issue creation event would have set off.  Jira does not currently have this ability. 

The closest similarity Jira Cloud has to what you are looking for would be the notifyUsers parameter as mentioned in PUT /rest/api/3/issue/{issueIdOrKey}.  That parameter can be used to made edits to issues without engaging the notification schemes associated in the project, but there is no equivalent for webhooks.

I would be interested though to learn more about your setup here and why are you seeking to do this?  Are you creating a plugin / app to be able to do this?  Or are you just seeking to be able to make this REST call manually on occasion?  I ask because I just want to try to understand the scale and scope of this request.

It might be possible to change the way in which webhooks are triggered to begin with, especially in Jira Cloud.  Instead of setting up the webhook to trigger directly upon a workflow event, or a workflow post-function, it might be possible instead to setup automation in Jira Cloud to send this webhook.  The advantage about this approach is that automation can be setup to check other criteria/conditions of the issue before it then executions the action therein.  Whereas system webhooks cannot, and in turn must execute all events that match their trigger criteria (such as "Issue Created" event).

But of course, if you are trying to create an app here, this solution might not be feasible as my explanation isn't intended to be done in a programmatic manner.  Instead what I am suggesting would be to disable that system webhook and create an automation rule to fire off this webhook but with more criteria.

Let me know your thoughts on this, or if you have any questions about this approach.

Andy

vahe.g November 24, 2020

Thanks for the reply @Andy Heinzer .

I'm creating a Jira plugin which should allow two-ways synchronization between Jira and Teamwork, and the reason I need this is to prevent webhook loops. i.e. a task created in Jira by the user, the Issue Created webhook fired and my system created the same task in Teamwork through their API. As I mentioned above, since I'm using ?fireWebhook=false on all TW API requests, Teamwork is not firing a reverse-webhook of the creation for that task and we don't have a webhook loop.

But if the user creates a task in Teamwork, the webhook is fired from Teamwork, my system creates the same task in Jira through Jira API, and Jira fires a webhook for the creation of that same task, so my system have to run additional condition checks to detect if that webhook requests is a result of action executed by my system or not.

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 25, 2020

Thanks for the additional context here.  I can see that my approach won't probably be helpful for you here.  I am not certain how you can achieve this.  But I would suggest trying to ask this over in our Developer Community https://community.developer.atlassian.com/

This other community has far more experience in regards to plugin development.  So perhaps they can better assist here.

Andy

Suggest an answer

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

Atlassian Community Events