title: Getting invalid payload when trying to cURL slack
body: <p>I am trying to cURL slack when nginx fails to reload. I am able to check that nginx failed and can cURL slack when it does. I am running into an invalid payload error when trying to include the error message from the failed reload within my cURL command. This is the script I have to do that:</p>
  
  <pre><code>#!/bin/bash
  
  OUTPUT=$(nginx -s reload 2&gt;&amp;1 &gt; /dev/null &gt;/mnt/efs/out.txt)
  
  ESCAPE=$(echo $OUTPUT | sed 's/"/\"/g' | sed "s/'/\'/g" )
  
  nginx -t || curl -X POST --data-urlencode 'payload={"username": "reload-monitor-lizard", "text": "'"${ESCAPE}"'", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/xxxxxxx/xxxxx/xxxxxxxxxxxxxxxxxxxx
  </code></pre>
  
  <p>I've tried playing around with the quotes, but it either still gives me the invalid payload error or sends</p>
  
  <blockquote>
    <p>${ESCAPE}</p>
  </blockquote>
  
  <p>as the message. Any suggestions on what I am doing wrong?</p>
  
  <p>Update:</p>
  
  <p>Fixed this by replacing the double quotes in my variable with single quotes like this:</p>
  
  <pre><code>ESCAPE=$(echo $OUTPUT | sed "s/\"/'/g" )
  </code></pre>