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).
  • Stringify the JSON object, remove {"blocks": from the beginning of the file, and remove any leading and trailing double quotes (see the example below).
  • 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:

          "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:

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

    This stringified data is almost ready to paste into xMatters.  Follow the steps below to get your data ready.


    How to Prepare Your Data

    To prepare your data for the xMatters "Slack - Post to Channel" Flow step:

    1. Start with suitable data, eg from
      • Note that data from the Slack Block Kit Builder will be preceded by {"blocks": - this will be removed in step 6
    2. Validate the JSON data, eg with
    3. Paste the data into a text editor
      • You can delete line breaks and whitespace if you want, but it's not necessary.
    4. Replace all \ (backslashes) with \\ (double backslashes).
    5. Replace all " with \" (ie, escape every double-quote with a backslash).
    6. Delete everything before the first [ (open square bracket).
    7. Delete everything after the last ] (open square bracket)
    8. Paste your data into the "Slack - Post to Channel" step in your workflow.

    Here's an example of correctly-prepared data:

    [{\"block_id\":\"text1\",\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"A message *with some bold text* and _some italicized text_.\"}}]
    Was this article helpful?
    0 out of 0 found this helpful



    Please sign in to leave a comment.

    • These steps does not work. 
      Is there any change after this post ?
      I am looking for ways to send blocks to slack via xMatters.

    • March 2022: instructions have been updated with field-tested steps and examples.

    • For someone else having trouble. With the updated instructions of removing the outer quotes and removing the outer JSON key "blocks" and the first curly braces which gets generated when using the Slack Block Kit builder.

    • Added step-by step instructions to prepare data for pasting into the "Slack - Post to Channel" Flow step in xMatters.