When sending POST requests to an address on Slack, the JSON needs to be formatted as such:
{"channel": "#testing", "username": "test", "text": "Subject"}
Or something of the sort, which is normal. The problem I'm having is really basic, but basically, I need to send some details that are obtained from an email via JSON, something like this:
{"channel": "#testing", "username": "#[message.inboundProperties['From']]", "text": "Subject"}
And when I log the payload after this, I get:
{"channel": "#testing", "username": ""Doe, John" <[email protected]>", "text": "Subject"}
And this throws a 500 error code, presumably because it is no longer valid JSON (my guess would be because of the weird quotations, but then if I do something else and do something like this:
{"channel": "#testing", "username": "username", "text": "#[message.payload]"}
Gives me this:
{"channel": "#testing", "username": "username", "text": "email body
", "icon_emoji": ":man_with_turban:"}
Which looks valid to me, but does not work (perhaps there's a new line character or something, but even then it's just a character in a string is it not?)
I'm not sure how I could do this properly.
You can use this page to validate JSON:
https://www.jsoneditoronline.org/