For webhook to slack, double qoute problem in custom data as json type in action of 'Send Web Reque'

Kix JY _Jong Yi Kim_ _TSE_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 8, 2021

i'm using webhook to slack.

and throw data type of json to slack. 

for example about custom data:

{
     "type": "section",
     "text": {
     "type": "mrkdwn",
     "text": "{{comment.body}}"
 }

if it is assigned double quote(") in smart value({{comment.body}}, occur invalid_payload error. so I tried some way, like using quote(), or replace(), but it doesn't work at that form.

i comfirmed it worked smart value where is in non json type data like "Send slack message(it is one of action type"

 

anybody help me?

1 answer

0 votes
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 8, 2021

Hi @Kix JY _Jong Yi Kim_ _TSE_ , welcome to the Community!

Not knowing the particulars of your situation, I would like to mention a couple possibilities that might simplify your setup.

  1. The official Jira for Slack plugins - in Cloud, it's pre-installed in Jira. For Server/Data Center, you can install it for free from the Marketplace . The app has a filter that you can use to trigger a message to a Slack channel when someone leaves a comment on an issue in a project, or even if the issue matches particular JQL. This is an easy way to send comments to Slack with a GUI for configuration.
  2. Jira's Automation - if you need things a little more advanced, Jira's Automation engine has an action to "Send Slack Message". On the backend, this still uses a webhook. But Automation handles escaping the message for you! See this documentation for setup instructions and an example of sending Slack messages with Automation .

I hope this helps! In most cases, one of these two options should make sending messages to Slack easier without having to manually configure a webhook.

Cheers,
Daniel | Atlassian Support

Kix JY _Jong Yi Kim_ _TSE_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 15, 2021

Hi Daniel, Thank you for your answer.

but unfortunately, i have to use "Send Web Request" to remain now form what i am using now. 

I'd like to use smart value library in "Send Web Request" in this case "quote().

but it is no working. 

So is there any method to solve this problem?

스크린샷 2021-07-15 오후 7.23.53.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events