0Pricing
AI Agents · Lesson

Building a Team Notification Bot

Scheduled messages, DM summaries, and channel alert agents.

Team Notification Bot Architecture

A team notification bot monitors external systems — deploys, CI/CD pipelines, monitoring alerts, error tracking — and posts formatted updates to relevant Slack channels. The core pattern: external event → webhook → agent → Slack message. The agent handles routing, formatting, and delivery.

# Team Notification Bot Flow:
#
# External System (GitHub, PagerDuty, Sentry, etc.)
#    |
#    | HTTP POST (webhook)
#    v
# Flask/FastAPI webhook endpoint
#    |
#    | Parse event
#    v
# Agent: classify, format, route
#    |
#    | Slack API
#    v
# Team channel / DM / thread

print('Webhook -> Agent -> Slack is the core notification pattern')

Receiving External Webhooks

External services send events to your bot via HTTP webhooks. Set up a Flask endpoint that receives POST requests, validates them (signature check if the service supports it), and passes the payload to your notification handler.

from flask import Flask, request, jsonify
import hmac
import hashlib
import os

flask_app = Flask(__name__)

@flask_app.route('/webhook/github', methods=['POST'])
def github_webhook():
    # Verify GitHub signature
    signature = request.headers.get('X-Hub-Signature-256', '')
    secret = os.environ['GITHUB_WEBHOOK_SECRET'].encode()
    body = request.get_data()
    expected = 'sha256=' + hmac.new(secret, body, hashlib.sha256).hexdigest()

    if not hmac.compare_digest(signature, expected):
        return jsonify({'error': 'Invalid signature'}), 403

    event_type = request.headers.get('X-GitHub-Event', '')
    payload = request.json

    handle_github_event(event_type, payload)
    return jsonify({'status': 'ok'}), 200

All lessons in this course

  1. Slack Bolt SDK Basics
  2. Listening to Events and Slash Commands
  3. Sending Messages and Rich Blocks
  4. Building a Team Notification Bot
← Back to AI Agents