Messenger API & Webhook Integration for Bots (2026 Tutorial)

Developer creating messenger bot with code editor and webhook architecture diagram

Automating notifications through messenger bots makes development workflows faster and easier. You get instant alerts when builds finish, errors happen, or deployments complete. This guide shows you how to set up bots that send automated messages via webhooks on popular messaging platforms. Need to notify your team about CI/CD results, server alerts, or process completions? These integrations make it simple. We only cover platforms with straightforward bot support. Some secure messengers put privacy first and do not support automation - those are listed separately.

Understanding Webhook-Based Bot Automation

Webhook-based bots work on a simple idea. Your app sends an HTTP POST request to a URL. The messaging platform then delivers that content to a channel or user.

This approach works well for many automation tasks:

  • Build notifications - Alert when a build succeeds or fails, with error details
  • Deployment updates - Notify teams when code reaches staging or production
  • Monitoring alerts - Send server health warnings or downtime notices
  • Scheduled reports - Deliver daily metrics or status summaries

The basic workflow has three steps:

  1. Create a bot or webhook URL on the target platform
  2. Set up your automation tool (CI/CD, monitoring system, or custom script) to send HTTP requests
  3. Format the message payload to match the platform's requirements

Choosing the right platform also depends on its security features. For a closer look at platform security, see our Ultimate Guide about Messengers in 2026.

Messenger Bot Integration Guides

Below are step-by-step guides for each platform that supports easy webhook-based bot integration.

Discord Webhook Bot

How to setup different webhook bots in 2026 simple and easy

Discord has one of the simplest webhook setups. You do not need a bot application or authentication tokens for basic message sending.

Step-by-Step Setup

  1. Open Server Settings - Right-click your server name and select "Server Settings"
  2. Navigate to Integrations - Click "Integrations" in the left sidebar
  3. Create Webhook - Click "Webhooks" then "New Webhook"
  4. Configure Webhook - Name your webhook (e.g., "Build Bot"), pick a channel, and optionally add an avatar
  5. Copy Webhook URL - Click "Copy Webhook URL" and store it safely

Sending Messages via Webhook

curl -X POST -H "Content-Type: application/json" \
  -d '{"content": "✅ Build completed successfully!\n\nProject: MyApp\nBranch: main\nDuration: 3m 42s"}' \
  https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN

Rich Embed Example for Error Notifications

curl -X POST -H "Content-Type: application/json" \
  -d '{
    "embeds": [{
      "title": "❌ Build Failed",
      "color": 15158332,
      "fields": [
        {"name": "Project", "value": "MyApp", "inline": true},
        {"name": "Branch", "value": "feature/login", "inline": true},
        {"name": "Error", "value": "```TypeError: Cannot read property of undefined```"}
      ],
      "timestamp": "2026-01-15T10:30:00.000Z"
    }]
  }' \
  YOUR_WEBHOOK_URL

Official Documentation: Discord Webhook Documentation

Slack Webhook Bot

How to setup different webhook bots in 2026 simple and easy

Slack uses Incoming Webhooks as part of its Slack Apps system. It supports rich message formatting and flexible channel targeting.

Step-by-Step Setup

  1. Create Slack App - Go to api.slack.com/apps and click "Create New App"
  2. Choose Creation Method - Select "From scratch" and give your app a name (e.g., "CI/CD Notifications")
  3. Enable Incoming Webhooks - Go to "Incoming Webhooks" in the sidebar and toggle it on
  4. Add Webhook to Workspace - Click "Add New Webhook to Workspace"
  5. Select Channel - Pick the channel for notifications and click "Allow"
  6. Copy Webhook URL - Your unique webhook URL will appear on screen

Sending Messages via Webhook

curl -X POST -H "Content-Type: application/json" \
  -d '{"text": "✅ Deployment to production completed successfully!"}' \
  https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXX

Block Kit Message for Detailed Notifications

curl -X POST -H "Content-Type: application/json" \
  -d '{
    "blocks": [
      {
        "type": "header",
        "text": {"type": "plain_text", "text": "🚨 Build Failed"}
      },
      {
        "type": "section",
        "fields": [
          {"type": "mrkdwn", "text": "*Project:*\nMyApp"},
          {"type": "mrkdwn", "text": "*Branch:*\nmain"},
          {"type": "mrkdwn", "text": "*Error:*\n`Module not found`"}
        ]
      }
    ]
  }' \
  YOUR_WEBHOOK_URL

Official Documentation: Slack Incoming Webhooks Guide

Microsoft Teams Webhook Bot

How to setup different webhook bots in 2026 simple and easy

Microsoft Teams supports Incoming Webhooks for channel notifications. These are set up through the connectors system.

Step-by-Step Setup

  1. Open Channel Settings - Go to the target channel and click the three dots (•••) next to the channel name
  2. Select Connectors - Click "Connectors" (or "Manage channel" then "Connectors" in newer versions)
  3. Find Incoming Webhook - Search for "Incoming Webhook" and click "Configure"
  4. Name Your Webhook - Enter a name (e.g., "Build Alerts") and optionally upload an image
  5. Create and Copy URL - Click "Create" and copy the webhook URL

Sending Messages via Webhook

curl -X POST -H "Content-Type: application/json" \
  -d '{"text": "✅ Build #1234 completed successfully on main branch"}' \
  YOUR_TEAMS_WEBHOOK_URL

Adaptive Card for Rich Notifications

curl -X POST -H "Content-Type: application/json" \
  -d '{
    "type": "message",
    "attachments": [{
      "contentType": "application/vnd.microsoft.card.adaptive",
      "content": {
        "type": "AdaptiveCard",
        "version": "1.2",
        "body": [
          {"type": "TextBlock", "size": "Large", "weight": "Bolder", "text": "❌ Build Failed"},
          {"type": "FactSet", "facts": [
            {"title": "Project:", "value": "MyApp"},
            {"title": "Error:", "value": "Compilation failed"}
          ]}
        ]
      }
    }]
  }' \
  YOUR_TEAMS_WEBHOOK_URL

Official Documentation: Microsoft Teams Incoming Webhooks

Telegram Bot

How to setup different webhook bots in 2026 simple and easy

Telegram has a powerful Bot API for sending messages programmatically. Instead of a webhook URL, you send requests directly to Telegram's API.

Step-by-Step Setup

  1. Create Bot via BotFather - Open Telegram and search for @BotFather
  2. Start New Bot - Send the /newbot command
  3. Name Your Bot - Follow the prompts to set a display name and username (must end in "bot")
  4. Save API Token - BotFather gives you a token like 123456789:ABCdefGHIjklMNOpqrsTUVwxyz
  5. Get Chat ID - Add the bot to your group or channel, send a message, then visit https://api.telegram.org/bot<TOKEN>/getUpdates to find the chat ID

Sending Messages via Bot API

curl -X POST \
  "https://api.telegram.org/bot/sendMessage" \
  -d "chat_id=" \
  -d "text=✅ Build completed successfully!%0A%0AProject: MyApp%0ABranch: main" \
  -d "parse_mode=HTML"

Formatted Message with HTML

curl -X POST \
  "https://api.telegram.org/bot/sendMessage" \
  -H "Content-Type: application/json" \
  -d '{
    "chat_id": "",
    "text": "❌ Build Failed\n\nProject: MyApp\nBranch: main\nError: Module not found",
    "parse_mode": "HTML"
  }'

Official Documentation: Telegram Bot API

Mattermost Webhook Bot

How to setup different webhook bots in 2026 simple and easy

Mattermost is an open-source alternative to Slack. It has strong webhook support and works well for self-hosted team communication.

Step-by-Step Setup

  1. Access Integrations - Click the hamburger menu, then "Integrations"
  2. Create Incoming Webhook - Select "Incoming Webhooks" then "Add Incoming Webhook"
  3. Configure Webhook - Set a title, description, and default channel
  4. Save and Copy URL - Click "Save" and copy the webhook URL

Sending Messages via Webhook

curl -X POST -H "Content-Type: application/json" \
  -d '{"text": "✅ Build completed successfully!"}' \
  https://your-mattermost-server.com/hooks/YOUR_WEBHOOK_ID

Rich Attachment Message

curl -X POST -H "Content-Type: application/json" \
  -d '{
    "attachments": [{
      "fallback": "Build Failed",
      "color": "#FF0000",
      "title": "❌ Build Failed",
      "fields": [
        {"short": true, "title": "Project", "value": "MyApp"},
        {"short": true, "title": "Branch", "value": "main"},
        {"short": false, "title": "Error", "value": "```Module not found```"}
      ]
    }]
  }' \
  YOUR_WEBHOOK_URL

Official Documentation: Mattermost Incoming Webhooks

Matrix/Element Bot

How to setup different webhook bots in 2026 simple and easy

Matrix is an open protocol for decentralized communication. Element is its most popular client. To integrate a bot, you use the Matrix Client-Server API.

Step-by-Step Setup

  1. Create Bot Account - Register a new Matrix account for your bot on your homeserver or matrix.org
  2. Get Access Token - Log in and find the access token in Element: Settings - Help & About - Advanced - Access Token
  3. Get Room ID - Join the target room with your bot, then find the room ID in Room Settings - Advanced
  4. Invite Bot to Room - Make sure the bot account has joined the room where it will send messages

Sending Messages via Matrix API

curl -X PUT \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"msgtype": "m.text", "body": "✅ Build completed successfully!"}' \
  "https://matrix.org/_matrix/client/r0/rooms/YOUR_ROOM_ID/send/m.room.message/$(date +%s)"

Formatted Message with HTML

curl -X PUT \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "msgtype": "m.text",
    "body": "Build Failed\nProject: MyApp\nError: Module not found",
    "format": "org.matrix.custom.html",
    "formatted_body": "

❌ Build Failed

Project: MyApp
Error: Module not found

" }' \ "https://matrix.org/_matrix/client/r0/rooms/YOUR_ROOM_ID/send/m.room.message/$(date +%s)"

Tip: For easier Matrix bot development, try using libraries like matrix-nio (Python) or matrix-bot-sdk (JavaScript).

Official Documentation: Matrix Client-Server API Specification

WhatsApp Business Bot

How to setup different webhook bots in 2026 simple and easy

WhatsApp offers a Business API for automated messaging. It requires business verification and is more complex to set up than other platforms.

Step-by-Step Setup

  1. Create Meta Business Account - Visit business.facebook.com and create a business account
  2. Set Up WhatsApp Business - Go to developers.facebook.com, create an app, and add the WhatsApp product
  3. Configure Phone Number - Add a phone number for your bot (test numbers are available for development)
  4. Get Access Token - Generate a permanent access token from the app dashboard
  5. Verify Business - Complete business verification before going live

Sending Messages via Cloud API

curl -X POST \
  "https://graph.facebook.com/v17.0/YOUR_PHONE_NUMBER_ID/messages" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "to": "RECIPIENT_PHONE_NUMBER",
    "type": "text",
    "text": {"body": "✅ Build completed successfully!"}
  }'

Important: WhatsApp requires message templates when starting conversations with users. You can only send free-form messages within 24 hours of a user interaction. For automated notifications, create and get your message templates approved first.

Official Documentation: WhatsApp Cloud API Documentation

Facebook Messenger Bot

How to setup different webhook bots in 2026 simple and easy

Facebook Messenger bots need a Facebook App and Page. Messages are sent through the Send API.

Step-by-Step Setup

  1. Create Facebook App - Go to developers.facebook.com and create a new app (choose "Business" type)
  2. Add Messenger Product - In your app dashboard, click "Add Product" and select Messenger
  3. Connect Facebook Page - Link a Facebook Page to your app (create one if needed)
  4. Generate Page Access Token - In Messenger settings, generate a token for your page
  5. Get PSID - Users must message your page first. Capture their Page-Scoped ID (PSID) from webhook events

Sending Messages via Send API

curl -X POST \
  "https://graph.facebook.com/v17.0/me/messages" \
  -H "Content-Type: application/json" \
  -d '{
    "recipient": {"id": "USER_PSID"},
    "message": {"text": "✅ Build completed successfully!"},
    "access_token": "YOUR_PAGE_ACCESS_TOKEN"
  }'

Note: Facebook Messenger has strict rules about automated messaging. Bots can only send promotional messages within 24 hours of a user interaction. For notifications outside this window, apply for specific message tags or use the one-time notification feature.

Official Documentation: Facebook Messenger Platform Documentation

Messengers Without Easy Bot Support

The following messengers put privacy and security first. This means webhook-based bot integration is either not possible or not practical:

  • Signal - No official bot API. Signal focuses on end-to-end encryption and avoids automation features that could reduce security.
  • Session - A decentralized messenger with no bot infrastructure. Its onion routing design makes automated messaging impractical.
  • Briar - A peer-to-peer messenger built for activists and journalists. No server infrastructure means no webhook support.
  • Wire - Has some enterprise API features, but no simple webhook system for automated notifications.
  • Wickr - Enterprise-focused with no public bot API. Automation requires Wickr Enterprise with custom integration.
  • SimpleX - Designed without user identifiers, which makes bot integration not compatible with its architecture.
  • Threema - Offers Threema Gateway for businesses, but it is a paid service requiring contracts - not a simple webhook setup.
  • Viber - Has a bot API, but it requires business account approval and is built for customer service, not developer notifications.
  • LINE - Offers a Messaging API, but it requires business account verification and is complex for simple notification use cases.
  • WeChat - Has an Official Account API, but it requires Chinese business registration and government approval.

If you prefer these platforms for secure communication, consider pairing them with a supported platform for automation. You can also read our guide on keeping private messages truly secure.

Practical Implementation Example

Here is a complete Node.js example that sends build notifications to multiple platforms at the same time:

const axios = require('axios');

const notifiers = {
  discord: async (message, webhookUrl) => {
    await axios.post(webhookUrl, { content: message });
  },

  slack: async (message, webhookUrl) => {
    await axios.post(webhookUrl, { text: message });
  },

  telegram: async (message, token, chatId) => {
    await axios.post(`https://api.telegram.org/bot${token}/sendMessage`, {
      chat_id: chatId,
      text: message,
      parse_mode: 'HTML'
    });
  },

  teams: async (message, webhookUrl) => {
    await axios.post(webhookUrl, { text: message });
  }
};

async function notifyBuildResult(success, project, branch, error = null) {
  const emoji = success ? '✅' : '❌';
  const status = success ? 'succeeded' : 'failed';
  let message = `${emoji} Build ${status}\n\nProject: ${project}\nBranch: ${branch}`;
  if (error) message += `\nError: ${error}`;

  const notifications = [
    notifiers.discord(message, process.env.DISCORD_WEBHOOK),
    notifiers.slack(message, process.env.SLACK_WEBHOOK),
    notifiers.telegram(message, process.env.TELEGRAM_TOKEN, process.env.TELEGRAM_CHAT_ID),
    notifiers.teams(message, process.env.TEAMS_WEBHOOK)
  ];

  await Promise.allSettled(notifications);
}

// Usage in your CI/CD pipeline
notifyBuildResult(false, 'MyApp', 'main', 'Module not found: @utils/helper');

Key Takeaways:

  • Discord, Slack, and Mattermost have the simplest setup - just create and use a URL
  • Telegram needs a bot token and chat ID, but offers great reliability and formatting
  • Microsoft Teams uses Adaptive Cards for rich notifications
  • Matrix/Element takes more setup but works well for self-hosted environments
  • WhatsApp and Facebook Messenger have stricter rules and messaging policies
  • Privacy-focused messengers do not have bot APIs by design, to protect user security

Conclusion

Setting up webhook-based bot notifications across messenger platforms adds powerful automation to your development workflow. Discord and Slack are the easiest to start with - just use a simple webhook URL. Telegram is reliable and easy to set up. For enterprise teams, Microsoft Teams and Mattermost fit well with existing tools. Matrix gives you a self-hosted, privacy-friendly option with full API access.

Start with one platform. Test your notification workflow. Then add more channels as needed. The code examples above work right away. Your next step is to create a webhook on your chosen platform and send your first automated message - it takes less than 10 minutes.

Frequently Asked Questions

Discord is the easiest. Create a webhook in channel settings and you get a URL you can POST messages to right away. No tokens, no app creation, no verification needed. Slack is also simple, but you need to create a Slack App first.

No. Privacy-focused messengers like Signal, Session, Briar, and SimpleX do not have bot APIs. This is a deliberate choice to protect user privacy. These platforms focus on end-to-end encryption and minimal data collection, which does not work well with automated messaging. For notifications, use a supported platform alongside your secure messenger for private conversations.

Yes, treat webhook URLs like passwords. Anyone with the URL can send messages to your channel. Store them in environment variables, never commit them to version control, and regenerate them if they are exposed. Some platforms like Slack let you create a new webhook URL if needed.

Webhooks are one-way. You send a message to a URL and it appears in a channel. Bot APIs work both ways. You can send messages and also receive and reply to user messages. For simple notifications like build alerts or monitoring, webhooks are enough. For bots that respond to user commands, you need the full bot API with a webhook endpoint on your server.

Most platforms have rate limits. Discord allows 30 messages per minute per webhook. Slack has similar limits. Use message queuing with exponential backoff for retries. For high volumes, batch multiple events into one message or use platform-specific bulk APIs where available.