Including Slack blocks data in the "Post to Channel" step


In Flow Designer, the Slack step "Post to Channel" includes a Blocks field that allows blocks data to be sent to Slack. How do I format the content of this step to make sure the post to Slack succeeds?


All versions of xMatters


In Slack, blocks are visual components that can be stacked and arranged to create app layouts and improve the appearance and interactivity of messages.

To successfully send blocks data from Flow Designer to Slack, the data must consist of a valid JSON object that has been converted to a string.

Here's how to create suitable content for the Blocks field: 

  1. Use Slack's online Block Kit Builder or your preferred tool to create a JSON object that conforms to the Slack Blocks specification.
      • If you're using something other than the Block Kit Builder, make sure your JSON is valid (using an online validation tool, for example).
  2. Stringify the JSON object and surround it with double quotes. (Some online tools, such as this one, can validate and stringify in one operation.)

Your data is now ready to paste into the Blocks field of the Post to Channel step in Flow Designer.


Stringifying a JSON object includes escaping any characters that will prevent Slack from accepting your Blocks code (such as converting \n to \\n) and collapsing any white space.

Here's an example JSON object from Slack's reference documentation for Blocks:

  "blocks": [
      "block_id": "text1",
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "A message *with some bold text* and _some italicized text_."

And here's what it looks like after it has been stringified:

"{\"blocks\":[{\"block_id\":\"text1\",\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"A message *with some bold text* and _some italicized text_.\"}}]}"
Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk