Skip to main content

Slack outbound webhooks

Enhance your observability workflows by sending real-time event notifications and log data to Slack. With this outbound webhook, you can integrate Coralogix with Slack, automate responses to critical events, and improve your organization's incident management and alerting processes.

Prerequisites​

Access your Slack webhook URL.

1.

While logged into Slack, open this link.

2.

Select the room name. Select Add incoming webhook integration.

3.

Copy the webhook URL.

Create a Slack webhook​

1.

From the Coralogix toolbar, select Integrations, then Extensions.

2.

In the Outbound Webhooks section, select Slack Webhook.

Slack Webhook option in Coralogix Outbound Webhooks

3.

Select Ad New.

4.

Enter the following details for your webhook:

  • Webhook Name. Enter a name that helps you find this webhook when you attach it to an alert.
  • URL. Paste the Slack webhook URL you previously copied (prerequisite step).
5.

Select the types of events for which you would like to receive notifications. The Notify About section allows you to select any of four general notifications and send them to the Slack channel webhook you are creating.

The four general notification types are:

  • Error and critical logs
  • Flow anomalies
  • Spike anomalies
  • Data usage
6.

Select Save & Test.

The system sends a test message to the channel you specified in the Slack webhook URL and to check that your configuration is valid. If the test message is received successfully, a confirmation message is displayed.

7.

After the configuration is confirmed and the webhook is in place, select the alert or alerts that use this webhook when they trigger.

Custom webhook body for Slack​

When sending a request to a Slack incoming webhook, direction is relative: the URL is incoming to Slack, which receives the message, and outbound from Coralogix, which sends it. You create it in Slack and configure it here under outbound webhooks.

Use the Slack Webhook type described above unless you need a body shape Coralogix does not build for you. It targets the same Slack incoming webhook URL and composes the request Slack expects.

When you do need a custom body, the Slack webhook URL accepts a POST with a JSON content type and a body that carries a top-level text key. A successful request returns HTTP 200 with the plain text body ok. When the body carries no text key and no blocks array, Slack rejects the request and returns the error no_text. When Slack cannot parse the body, it returns invalid_payload. Slack's blocks array adds rich formatting on top of text; keep the top-level text key when you use it, so the message still has fallback text. See Sending messages using incoming webhooks in Slack's documentation.

The generic webhook's example body keeps its only text entry inside the fields array, so Slack returns no_text and nothing reaches the channel. Abridged to the keys that matter:

{
"alert_id": "$ALERT_ID",
"name": "$ALERT_NAME",
"fields": [
{ "key": "text", "value": "$LOG_TEXT" }
]
}

Slack reads text only at the top level. Flatten the body to a single top-level text key, and compose its value from the placeholders available to generic webhooks:

{"text": "$ALERT_NAME ($EVENT_SEVERITY) - $ALERT_DESCRIPTION. Logs: $LOG_URL"}

Select TEST CONFIG on the generic webhook after editing the body. It sends an HTTP call to the Slack URL and displays a confirmation when the call is received. Check the Slack channel for the test message to confirm Slack accepted the body.

Additional resources​

Next steps​

Automatically create Jira issues when alerts trigger with Jira outbound webhooks.

Last updated on