DEV Community

lutif
lutif

Posted on

Stop Paying for Slack Alerts: Send Sentry Errors to Slack for Free

Tired of paying for Sentry’s Slack integration? Good news: you don’t have to.

With a simple setup using Sentry webhooks, Vercel Edge Functions, and Slack’s free API, you can receive real-time error notifications in Slack—without paying for a premium plan.

Here’s how to set it up.

Why Pay for What You Can Build?

Sentry’s built-in Slack integration sits behind a paywall. For indie developers and small projects, that cost often isn’t justified.

Instead, you can:

  • Use Sentry’s webhook integration
  • Catch events with a Vercel Edge Function
  • Send formatted messages using Slack’s free chat.postMessage API

Same result. Zero extra cost.

Step 1: Set Up the Sentry Webhook

Sentry provides a legacy webhook integration that sends event data to any external endpoint.

Open your Sentry project settings

Go to Legacy Integrations → Webhooks

Add a new webhook

(You'll paste your Vercel function URL here after deployment)

That’s it. Sentry will now send error events to your custom endpoint.

Step 2: Create the Vercel Edge Function

If you’re new to Vercel, it’s a serverless platform that runs code at the edge with a generous free tier.

We’ll create an Edge Function that:

  1. Receives Sentry events
  2. Formats them using Slack Block Kit
  3. Sends them to Slack via API

Here’s the function:

export const config = {
  runtime: 'edge',
};

const sendMessage = async (
  channel,
  { level, formatted, environment, email, title, culprit, project }
) => {
  const isError = level === "error";

  const blocks = [
    {
      type: "section",
      text: {
        type: "mrkdwn",
        text: `${isError ? ":red_circle:" : ""} *${title}*`,
      },
    },
    {
      type: "section",
      fields: [
        { type: "mrkdwn", text: `*Environment:*\n${environment}` },
        { type: "mrkdwn", text: `*Level:*\n${level}` },
        { type: "mrkdwn", text: `*Project:*\n${project}` },
      ],
    },
    {
      type: "section",
      fields: [
        { type: "mrkdwn", text: `*User:*\n${email}` },
      ],
    },
    { type: "divider" },
    {
      type: "section",
      text: {
        type: "mrkdwn",
        text: `*Message:*\n${formatted}`,
      },
    },
    {
      type: "section",
      text: {
        type: "mrkdwn",
        text: `*Culprit:*\n${culprit}`,
      },
    },
    { type: "divider" },
  ];

  await fetch("https://slack.com/api/chat.postMessage", {
    method: "POST",
    headers: {
      "Content-Type": "application/json; charset=utf-8",
      Authorization: `Bearer ${process.env.SLACK_ACCESS_TOKEN}`,
    },
    body: JSON.stringify({
      channel,
      blocks,
    }),
  });
};

export default async (req) => {
  const body = await req.json();

  const {
    project,
    culprit,
    event: {
      level,
      logentry: { formatted },
      user: { email },
      environment,
      metadata: { title },
    },
  } = body;

  await sendMessage(process.env.CHANNEL_ID, {
    level,
    formatted,
    environment,
    email,
    title,
    culprit,
    project,
  });

  return new Response("Event received");
};
Enter fullscreen mode Exit fullscreen mode

What This Does

Receives error events from Sentry

Formats structured Slack messages using blocks

Posts directly to Slack using an OAuth token

Step 3: Create and Configure Your Slack App

To allow Slack to receive messages:

Go to api.slack.com/apps

Create a new app in your workspace

Under OAuth & Permissions, add:

chat:write

Install the app to your workspace

Copy the OAuth Bot Token

Now add these environment variables in Vercel:

SLACK_ACCESS_TOKEN

CHANNEL_ID

Step 4: Deploy to Vercel

Push your code to GitHub

Import the repo into Vercel

Add your environment variables

Deploy

Once deployed, copy the function URL and paste it into your Sentry webhook settings.

Done.

Step 5: Test It

Trigger a test error in Sentry.

If everything is configured correctly, you’ll see a clean, structured error notification in Slack within seconds.

Why This Setup Wins

  • Completely Free
  • Real-time notifications
  • Fully customizable Slack formatting
  • Serverless and low maintenance
  • Works on Sentry’s free plan

You’re essentially recreating the paid integration—with more flexibility.

Grab the Code & Customize It

Feel free to adapt this setup for your own workflow:

Add severity filtering

Route different projects to different channels

Format alerts differently for staging vs production

If this helped you save money or level up your monitoring setup, leave a start and share it with other developers. Small optimizations like this make a big difference over time.

Check out the GitHub Repository Here

Happy building 🚀

Top comments (0)