If I run the curl with json directly as part of the syntax the request goes through but if I replace it with a variable it through error. How do I get around it
dataset='{
"channel": "#staging2-setup",
"username": "SQS Notification",
"text": "test"
}'
echo $dataset
curl -X POST \
https://slack.com/api/chat.postMessage \
-H 'authorization: Bearer xoxb-XXXXXXXXX' \
-H 'content-type: application/json' \
-d $dataset
Error message
{"ok":false,"error":"invalid_json","warning":"missing_charset","response_metadata":{"warnings":["missing_charset"]}}curl: (6) Could not resolve host: "channel"
curl: (6) Could not resolve host: "
curl: (6) Could not resolve host: "username"
curl: (6) Could not resolve host: "SQS
curl: (6) Could not resolve host: Notification",
curl: (6) Could not resolve host: "text"
curl: (6) Could not resolve host: "test"
curl: (3) [globbing] unmatched close brace/bracket in column 1