Slack Message Type Block, issue with json parsing but not sure best way to work around
What is the error message (if any)?
{
“type”: “section”,
“text”: {
“type”: “mrkdwn”,
“text”: “{{ $json[“orderItems”].join(”\n") }}"
}
}
ERROR: Unexpected token in JSON at position 606
the join is causing me problems but I need the join to prevent slack from spamming messages over and over for each item. Not sure best way to fix as its adding newlines as well as the \n
{
“type”: “section”,
“text”: {
“type”: “mrkdwn”,
“text”: “sampletext
sampletext”
}
}
So I have had to remove the spreadsheet info as it contains personal information however the spreadsheet contains item sales data directly from our magento store
so examples of items are below,
name
Pokemon - Scarlet & Violet - Base Set - Booster Pack
Pokemon - Sun & Moon - Miracle Twins - Japanese Booster Pack
Free Sweets
Pokemon Sticker
Yu-Gi-Oh! - 2-Player Starter Set
Yu-Gi-Oh! Sticker
Free Sweets
Keyring
Pokemon - Holiday Calendar 2023
Keyring
Pokemon Sticker
Free Haribo
and I am trying to use a .join so slack doesnt message for each item individually.
This workflow works fine for a normal slack message, but the issue is coming from me trying to use similar in a message block in slack to try and make the messages look nicer
So I ran into a similar issue when creating a product sync thing between the TikTok Shop and our Ecommerce platform. I was struggling to submit the JSON of the product description as it contained new lines and </p> tags and stuff.
The solution to this which also fixed this Slack issue I was having was the following