Forums

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

How to correctly send a post request from Jira

Daria A September 6, 2021

Hi!

I need to send post request from Jira Data Center to private Slack channel.

Now I have the task to drop the legacy solution like custom integration "Incoming webhook", but sending to app's webhoo does not allow to send a message to the private channel, and it also prohibits to change the channel.

If I understand correctly, the only option I have is to send a post request. I have tested on the test page in the documentation https://api.slack.com/methods/chat.postMessage/test, specifying the channel id, token and text. The message came through.

Снимок экрана 2021-09-06 в 19.41.39.pngHowever, when I try to send a request as a result of a rule in Jira or via Postman, nothing comes to Slack.

Is it possible that I am doing something wrong? Below is a screenshot of my rule settings where the status in the logs is success, but the request doesn't get through, apparently due to improper composing in the rule.

Снимок экрана 2021-09-06 в 17.10.29.png

2 answers

1 accepted

0 votes
Answer accepted
Neil Mansilla
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 9, 2021

In Postman, you're posting a URL-encoded body, whereas in Jira Automation, you're posting a JSON body. So, if I were you, I would try to get a successful request in Postman using JSON body with your bot token in the Authorization header (and remove the token value from the JSON body). Be sure to check out this Slack docs section.

Once you're able to do that in Postman, I would then try recreating the request in Jira Automation.

Daria A September 10, 2021

Thanks a lot for your help!

After trying different ways, I managed to get the rule to work. I'm attaching a screenshot of the correct usage here in case anyone encounters something similar.

Снимок экрана 2021-09-10 в 15.22.02.png

Like # people like this
0 votes
Neil Mansilla
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 6, 2021

Hello there. According to Slack's documentation, you need to add the authorization token (your bot token) in the header. For instance, in your first attachment, you see:

Authorization: Bearer xoxb-xxxxx

Try adding that to your request in Postman first, and see how it goes. In fact, in your shoes, I would only spend time getting my Postman request to work properly before trying to move onto Jira Automation.

And.. if the solution is as simple as my suggestion above, for Automation, you'd simply add another header, one for "Authorization", that is.

Good luck! And welcome to the Community!

Daria A September 9, 2021

Hi, @Neil Mansilla !

Thanks for the answer.

In the end I was finally able to send a request from Postman. It looks like this:

Снимок экрана 2021-09-09 в 22.22.02.png

Any idea how to convert this to send the same thing from Jira? I've tried a bunch of options and don't understand what I'm doing wrong or how to correctly specify all the parameters. Also i've tried using Authorization header with value "Bearer xoxb-xxx..." but still nothing.

Suggest an answer

Log in or Sign up to answer