I’ve been trying to wire up a webhook in Genesys Cloud to push alerts to Slack whenever a queue breaches its service level. We’re using this for WFM adherence tracking, so it’s pretty critical that the notification actually renders correctly in the channel.
The webhook fires fine. I can see the events coming through in the logs. The problem is the JSON structure I’m sending to Slack’s incoming webhook endpoint. It keeps failing validation with a 400 Bad Request.
Here’s the payload I’m constructing in the webhook action. I’m trying to use Slack’s block kit format.
{
"channel": "#wfm-alerts",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":warning: Queue SLA Breach\nQueue: ${queue.name}\nCurrent SLA: ${metrics.sla.value}"
}
}
]
}
The error response from Slack is pretty vague.
{"error": "invalid_blocks"}
I’m using the queue.name and metrics.sla.value from the Genesys Cloud event payload. I know the event data is correct because I’ve logged it to a file and the values look good. But when it hits Slack, it chokes.
Is there something specific about how Genesys Cloud webhooks handle nested objects or special characters in the substitution? I’ve tried escaping the newlines with \n and even \r\n but no luck. The documentation for the webhook action doesn’t really cover the Slack block kit specifics.
Does anyone have a working example of a Slack block payload from a Genesys Cloud webhook? I feel like I’m missing a simple syntax error here.