Atlassian connect add-on can't use context parameters in descriptor file

Hi everyone, i got two issues with the descriptor file in my connect add-on.

(1) About webhook:

I want update our database when user changed an issue status, so i use webhook "jira:issue_updated" to do this as the code below in descriptor file:

 

....
"webhooks": [
{
"event": "jira:issue_updated",
"url": "/issue-updated"
}
....

 

However i just got the request with "user_key", what i need is at least i can get the "issue_key", then i can use REST API to query the last status of issue. If i can get immediately what's changed about issue is so great.

 

I also tried with this:

 

....
"webhooks": [
{
"event": "jira:issue_updated",
"url": "/issue-updated/?issue_key={issue.key}"
}
....

 

and

 

....
"webhooks": [
{
"event": "jira:issue_updated",
"url": "/issue-updated/?issue_key=${issue.key}"
}
....

 

 

However, i can't install the add-on with the url contain the context parameter, it says: "An error occurred while installing the add-on. Refer to the logs for more information."

(I follow this instruction: https://developer.atlassian.com/static/connect/docs/latest/modules/common/webhook.html  to do the webhook)

 

(2) About the Lifecycle callback to our server whenever user installed the add-on:

The callback works fine, however i also only received the parameter "user_key", and no anything more. How can i receive other parameters like this?

{
"key": "installed-addon-key",
"clientKey": "unique-client-identifier",
"publicKey": "MIGf....ZRWzwIDAQAB",
"sharedSecret": "a-secret-key-not-to-be-lost",
"serverVersion": "server-version",
"pluginsVersion": "version-of-connect",
"baseUrl": "http://example.atlassian.net",
"productType": "jira",
"description": "Atlassian JIRA at https://example.atlassian.net",
"serviceEntitlementNumber": "SEN-number",
"eventType": "installed"
}

(I follow this instruction: https://developer.atlassian.com/static/connect/docs/latest/modules/lifecycle.html to do the the callback of lifecycle)

 

Thanks so much for viewing my issues.

 

2 answers

1 vote

Hi Han, I think you have the same issue with both requests. You are expecting the results to come back in the URL query parameters but both of those resources (the webhooks resource and the lifecycle resources) are actually POSTing data back to you that contains the information that you are looking for.

I highly recommend that you log the data that is coming back in the body of the response because then you will see it all in JSON format ready for your consumption.

If you want a tool that can do this for you with respect to webhooks then I highly recommend using the webhook-inspector: https://bitbucket.org/atlassianlabs/webhook-inspector

Hi Robert, thank you so much for your help.

Both requests are worked fine now and i got what i'm expecting, once again, thank you! smile

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,240 views 14 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot