Build a Slack Bot with This Webhook Template

Published: (December 14, 2025 at 04:47 AM EST)
3 min read
Source: Dev.to

Source: Dev.to

Cover image for Build a Slack Bot with This Webhook Template

The Template

Did you know there’s a minimal Slack webhook template for Codehooks.io that makes it ridiculously easy to start building Slack integrations? Here’s what makes it great:

  • ~90 lines of code – No bloat, easy to understand
  • Secure by default – HMAC SHA‑256 signature verification built‑in
  • Production‑ready – Handles URL verification, signature validation, and timing attacks
  • Serverless – No servers to manage, auto‑scales

Getting Started

coho create myapp --template webhook-slack-minimal
cd myapp
npm install
coho deploy

That’s it. Three commands. Your webhook is live.

What You Get Out of the Box

The template handles all the boring security stuff for you:

// Automatic signature verification
function verifySlackSignature(body, signature, timestamp) {
  // Rejects requests older than 5 minutes
  // Uses timing-safe comparison
  // Validates HMAC SHA-256 signature
}

// URL verification for Slack setup
if (body.type === 'url_verification') {
  return res.json({ challenge: body.challenge });
}

// Your bot logic starts here
if (event.type === 'message' && !event.bot_id && event.text) {
  console.log('Message:', event.text);
  // Do something cool
}

Just add your SLACK_SIGNING_SECRET environment variable, point Slack at your webhook URL, and you’ll start receiving events.

Cool Use Cases

Incident Response Bot

Automatically create tickets and notify on‑call engineers when someone types @bot incident in your #alerts channel. Parse the message, extract severity levels, and kick off your incident management workflow. Integrate with PagerDuty, Jira, or your internal tools.

if (event.text.includes('incident')) {
  // Parse incident details
  // Create ticket in your system
  // Page on-call engineer
  // Post confirmation back to channel
}

Code Review Reminder Bot

Monitor your #engineering channel and remind developers about pending code reviews. When someone mentions a PR link, the bot tracks it and sends daily reminders until it’s merged. Integrates with GitHub/GitLab APIs to check PR status.

if (event.text.includes('github.com') && event.text.includes('/pull/')) {
  // Extract PR URL
  // Check PR status via GitHub API
  // Schedule reminders for reviewers
  // Update team when merged
}

Knowledge Base Assistant

Create a smart assistant that answers common questions by searching your internal docs. Team members can ask @bot how do I deploy? and get instant answers with links to relevant documentation.

if (event.text.includes('@bot')) {
  const query = extractQuery(event.text);
  // Search your knowledge base
  // Format relevant results
  // Post back with helpful links
}

Why This Matters

Most Slack bot tutorials leave you wading through authentication flows, webhook verification logic, and security best practices. This template gives you that foundation in ~90 lines, so you can focus on building the actual bot logic.

The Codehooks.io platform handles deployment, scaling, environment variables, and logging. You just write JavaScript and deploy.

Next Steps

The template is minimal on purpose – it’s designed to be extended. Here are some ideas:

  • Install @slack/web-api to post messages back to Slack
  • Add slash commands for interactive workflows
  • Connect to databases, APIs, or AI services
  • Handle reactions, mentions, or other event types

Check out the template on GitHub and start building your Slack bot today!

Resources

Back to Blog

Related posts

Read more »

Assign issues to Copilot using the API

GraphQL support You can assign issues to Copilot using the following mutations: - updateIssuehttps://docs.github.com/graphql/reference/mutationsupdateissue - c...