How to format messages with SLACK connector?

Hello,

in the Slack connector guide, it is mentioned that messages might be formatted.

Is there a way to send a message like shown below with Camunda Slack connector???

I tried to put the following on the message field, but there is always an error during process execution.

{
	"blocks": [
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "This is unquoted text\n>This is quoted text\n>This is still quoted text\nThis is unquoted text again"
			}
		}
	]
}


Any ideas are welcomed.

Smith.

What is the error that you get?

Hi @jwulf ,

I use on the “Message” field on the Slack connector a variable called “message1” (as shown below).

image

When I start the process, I set the following variable.

{
"message1":{
	"blocks": [
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "This is unquoted text\n>This is quoted text\n>This is still quoted text\nThis is unquoted text again"
			}
		}
	]
}


}

The error is this one:
Failed to invoke connector, received the following error: java.lang.IllegalStateException: Expected STRING but was BEGIN_OBJECT at path $.data.text

The model is super simple:

Any ideas?

Try putting the JSON in as stringified JSON. In other words, JSON content, but as a single string.

Like this:

'{"blocks":[{"type":"section","text":{"type":"mrkdwn","text":"This is unquoted text\\n>This is quoted text\\n>This is still quoted text\\nThis is unquoted text again"}}]}'

Hi @jwulf ,

thanks once again for your reply.

Unfortunately, it doesn’t work. Even though the message is sent, when I see this message on Slack it’s not in the correct format.

Shown below without the correct format

Have you tried sending just the above string?