I have a JSON list and I am trying to POST a particular key: value from the list to the slack webhook using curl. I am using jq to get the value for a specific key
This works fine:
echo {{job.message}} | jq -r '.[0] | .status'
This does not work:
curl -vvv -X POST -H "Content-type: application/json" --data \"{\"text\":\"{{job.message}} | jq -r ''.[0] | .status''\"}\" https://hooks.slack.com/services/xxxxx
job.message
is a variable with json list
When I output the result using echo in shell, it works fine but when I use curl it show invalid payload or .key not found even though the key is present.