Developers

Slack Webhook Notifications: Send Alerts to a Channel in Minutes

How to send notifications to Slack with an incoming webhook: creating the webhook, posting messages from code, formatting with blocks, useful business alerts, avoiding noise, keeping the URL secret and handling errors.

On this page
  1. How incoming webhooks work
  2. Create the webhook
  3. Send your first message
  4. Format messages so they're scannable
  5. Useful alerts for a business
  6. No code? Use a ready-made connection
  7. Webhooks or a Slack app with a bot?
  8. Testing before you rely on it
  9. Avoid alert fatigue
  10. Keep the webhook URL secret
  11. Handle errors
  12. A worked example

Important events often happen in systems nobody is watching: a big order in the shop, a customer reply to an SMS reminder, a failed payment, a server error at night. If your team lives in Slack, the simplest fix is to put those events in a channel. Slack webhook notifications do exactly that: one URL, one HTTP request, and the message appears where people already are.

How incoming webhooks work#

A Slack incoming webhook is a unique URL connected to one channel in your workspace. Sending a JSON message to that URL with an HTTP POST posts the message into the channel. Slack's documentation on sending messages using incoming webhooks covers setup in detail. You don't need to build a full bot, handle authentication tokens or keep a connection open.

Create the webhook#

  1. Create a Slack app for your workspace (or use an existing one), from Slack's app management page.
  2. Turn on Incoming Webhooks for the app.
  3. Choose Add New Webhook to Workspace and pick the channel, such as #orders or #alerts.
  4. Copy the webhook URL. Store it as a secret, for example in an environment variable.

Send your first message#

curl -X POST -H "Content-Type: application/json" \
  -d '{"text": "New order #1042: $38 from Aline (Austin)"}' \
  "$SLACK_WEBHOOK_URL"

From code, it's the same request:

# Python
import os, requests
requests.post(os.environ["SLACK_WEBHOOK_URL"],
              json={"text": "New order #1042: $38 from Aline (Austin)"},
              timeout=10)

// Node.js
await fetch(process.env.SLACK_WEBHOOK_URL, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ text: 'New order #1042: $38 from Aline (Austin)' }),
});

Format messages so they're scannable#

Plain text works, but a little formatting helps people act quickly. Slack supports bold (*bold*), links (<https://example.com|View order>) and line breaks in text. For richer layouts, Slack's Block Kit lets you add sections, fields and buttons. Keep it simple:

  • Lead with what happened: "New order", "Payment failed", "Customer replied".
  • Add the two or three details needed to act: amount, customer, location.
  • Include a link to the record in your system.
  • Use emoji sparingly as a visual cue, such as one for orders and one for errors.

Useful alerts for a business#

  • New orders, especially large ones.
  • Customer replies to SMS or WhatsApp messages that need a person.
  • Failed payments or failed message sends.
  • New bookings and cancellations.
  • A sending phone or WhatsApp number going offline.
  • Website errors or downtime.

For example, forward SMS Gora sms.received and device.offline events to your server, verify them, and post the important ones to Slack. Our guide to receiving SMS by webhook shows the first half, and webhook signature verification explains the check.

No code? Use a ready-made connection#

If you'd rather not write code, the Tekservix developer platform has a Slack app in its app marketplace: paste your incoming webhook URL, choose the events, and Tekservix posts them to your channel. Automation tools can also catch webhooks from other services and post to Slack; see our guide to Zapier webhooks. Details are on the developer platform page.

Webhooks or a Slack app with a bot?#

Incoming webhooks are one-way: they post into a channel, and that's all. That's exactly right for notifications. If you want people to act on alerts from inside Slack, such as pressing "Approve" on a refund or replying to a customer from a thread, you need a Slack app with interactivity and a bot token, which is more work to build and secure.

A practical path for small teams: start with webhooks for visibility, include a link in each message that opens the record in your own system, and do the action there. Only build an interactive app once the team is clearly spending time switching back and forth. Most businesses never need to.

Testing before you rely on it#

Create a private test channel with its own webhook, point your development environment at it, and trigger each type of alert once. Check that messages read well on a phone, links open the right record, and nothing sensitive, such as full phone numbers or payment details, appears where the whole channel can see it. Then switch the production environment to the real channel.

Avoid alert fatigue#

A channel that pings 200 times a day gets muted, and then nobody sees the one alert that matters. Keep it useful:

  • Separate channels by urgency: #alerts for things that need action now, #activity for everything else.
  • Send only what someone will act on. Log routine events elsewhere.
  • Group noisy events into a daily or hourly summary.
  • Mention people only for real emergencies.

Keep the webhook URL secret#

Anyone with the URL can post to your channel, including fake alerts. Store it in environment variables or a secret manager, never in frontend code or public repositories, and don't paste it into screenshots or tickets. If it leaks, remove the webhook in the Slack app settings and create a new one. Our guide to API key security covers the same habits for other secrets.

Handle errors#

  • Set a timeout on the request, so a slow Slack response never blocks your main process.
  • Send notifications from a background job, not inside a customer's page request.
  • If Slack returns an error or rate-limits you, retry later with a delay; don't retry in a tight loop.
  • Never let a failed notification stop the real work, such as saving an order.

A worked example#

Imagine an online shop whose owner wants to know about big orders and customer problems without watching dashboards. The shop's system posts every order over $200 to #orders, with the customer's first name, total and a link. A small webhook handler receives SMS replies, and any reply that isn't a simple YES or NO is posted to #support with the customer's number. A daily summary of all orders goes to #activity at 18:00. The team sees what matters as it happens, the channels stay quiet enough to read, and nothing depends on someone remembering to check.

Frequently asked questions

What is a Slack incoming webhook?

A Slack incoming webhook is a unique URL tied to one channel. Any system that sends a JSON message to that URL with an HTTP POST makes the message appear in the channel, without needing a full Slack bot.

How do I send a message to Slack with a webhook?

Create an incoming webhook in a Slack app, choose the channel, copy the URL, then POST JSON such as {"text": "New order #1042"} to it from your code, a script or an automation tool.

Is a Slack webhook URL secret?

Yes. Anyone with the URL can post messages to your channel. Keep it in environment variables, never in public code or screenshots, and regenerate it if it leaks.

Share this article
Written by

The team behind Tekservix

The Tekservix Team builds and supports Tekservix: WhatsApp and SMS APIs, AI tools, invoicing, PDF and SEO tools for growing businesses. We write practical, tested guides based on what we see our customers do every day.

More articles from the Tekservix Team

Get new guides in your inbox

One short email when we publish something useful: WhatsApp and SMS marketing, AI tools, SEO and running a business online. No spam, unsubscribe anytime.