Problem in json for Slack blocks

Getting the following error after trying to send blocks based on an expression.

Error

SyntaxError: Unexpected token o in JSON at position 1 at JSON.parse (<anonymous>) at jsonParse (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/utils.js:64:21) at Object.getMessageContent (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Slack/V2/GenericFunctions.js:101:52) at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Slack/V2/SlackV2.node.js:489:78) at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:728:42) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:660:68 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1062:20

Payload

{"blocks": [{"type": "header", "text": {"type": "plain_text", "text": "Test block", "emoji": true}},{"type": "section", "text": {"type": "mrkdwn", "text": "Test  - Product View. "}},{"type": "section", "text": {"type": "plain_text", "text": "Tasks: Test, test, this one, the other one", "emoji": false}},{"type": "divider"},{"type": "section", "text": {"type": "mrkdwn", "text": "Error NAME - Category CATEGORY"}},{"type": "section", "text": {"type": "mrkdwn", "text": "*Expected value*\nValue"}},{"type": "section", "text": {"type": "mrkdwn", "text": "*Received value*\nValue"}},{"type": "divider"}]}

n8n version 1.39.1 (Self Hosted)

Not sure what’s wrong with the json.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@victorb , you need to stringify the block as in {{ $json.body.blocks.toJsonString() }}

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.