Webhook Endpoint Called on Subtask Creations - Gets Wrong Issue Key

John Horst February 25, 2020

I am developing webhook endpoints for my customer. I am testing them by using Hookbin to create an end point for my webhooks. I have an Subtask Issue Type called "Invoice Issue Type".  The Invoice Issue Type is a subtask to the Authorization Issue Type. The webhook get hit when the project = my project and issue type = invoice issue type on issue create.

The webhook is being hit as when I refresh the Hookbin page I see the issue's json just fine. the problem is the issue key in json does not correspond to the issue key in jira. they are always off by one. So if the webhook json says the issue key is LMT-114 it will actually be LMT-115.

This, then, causes my endpoint code to fail because there is no issue key LMT-114. It's like Jira is skipping a number in reality but not reporting that correctly to the webhook endpoint.

1 answer

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

Hi John,

If I understand the problem here, you are trying to create webhooks based on when Jira Cloud creates a new subtask, but that appears to be sending the incorrect issue key.

I would like to try to learn more about your setup and environment here to try to help.  Are you use the post-functions in the create transition as a means to trigger this webhook event?  If so, could you share with us the order of these post-functions (perhaps in a screenshot).  I ask this because I have seen some strange behavior before when post functions like webhooks get actioned before other events like re-index issue, or fire event, etc.   Many times post functions like this have to be the last to occur in order to make things work.

If this is not being executed in a post-function of the workflow, please let me know more about how this is being executed.  Are you creating an add-on to create the subtasks?  If so, please let me know what steps are being used to create these subtasks, (such as are you using the REST API endpoint to create them, or perhaps some JAVA API endpoint, or some other method here).

Also, would it be possible to share with us some of the example webhook payload being sent out?  I have this suspicion that perhaps with subtask creations, because all subtasks have to have a parent issue, that there might be two issue keys in the payload here, and we're sending the parent's issuekey instead of the child's issue key (the subtask's issue key).  But I'm not confident of that here, since you mentioned the issue key being sent doesn't exist in Jira.  If this idea was correct here, then you should at least get the wrong issue here in the parent of the subtask, instead of no valid issue at all.

Please let me know.

Andy

Suggest an answer

Log in or Sign up to answer