title: Invalid payload - Slack API JSON
body: <p>I am using a Groovy script to send a POST using the Slack API, at present I am getting <code>invalid_payload</code> returned and I think this is most likely due to the formatting of my JSON. I know the Slack API expects it JSON with double quotes but I can't seem to be able to pass a variable into the JSON object:</p>
  <pre><code>SUCCESS_MESSAGE = '{&quot;attachments&quot;: [{&quot;color&quot;: &quot;#2A9B3A&quot;, &quot;author_name&quot;: ${DEV_NAME}, &quot;title&quot;: &quot;Build Status&quot;, &quot;title_link&quot;: ${BUILD_URL}, &quot;text&quot;: &quot;Successful Build&quot; }]}'
  def response = [&quot;curl&quot;, &quot;-X&quot;, &quot;POST&quot;, &quot;-H&quot;, &quot;Content-Type: application/json&quot;, &quot;-d&quot;, &quot;${SUCCESS_MESSAGE}&quot;, &quot;https://hooks.slack.com/services/${SLACK_WEBHOOK}&quot;].execute().text
  </code></pre>
  <p>How should I correctly format my <code>SUCCESS_MESSAGE</code> var so I don't get the error?</p>