ITSkillsCenter
Business Digital

Intégrations webhooks et bots Mattermost : tutoriel pratique 2026

4 min de lecture

📍 Article principal du cluster : Mattermost 2026 : guide complet.

Mattermost devient puissant quand connecté à votre stack : Forgejo notifie les PR, Grafana alerte les SLO breaches, Uptime Kuma signale les downtimes, Wave Webhook confirme les paiements. Ce tutoriel détaille les configurations testées en production.

Prérequis

  • Mattermost en production avec compte admin.
  • Niveau attendu : intermédiaire.
  • Temps estimé : 1-2 heures pour 5 intégrations.

Webhook entrant : pattern général

Étape 1 — Créer webhook dans Mattermost

Profile picture → Integrations → Incoming Webhooks → Add. Saisir :

  • Title : nom service (Forgejo, Grafana…).
  • Channel : où poster.
  • Lock to channel : ON pour sécurité.

Mattermost génère URL type https://chat.../hooks/abc123xyz. Copier.

Étape 2 — Tester

curl -X POST -H "Content-Type: application/json" \
  -d '{"text":"Hello from cURL!"}' \
  https://chat.../hooks/abc123xyz

Message apparaît dans channel Mattermost.

Intégration Forgejo

Settings repo Forgejo → Webhooks → Add webhook → Mattermost. Configuration :

  • Target URL : webhook Mattermost copié.
  • Channel : nom channel.
  • Username : forgejo-bot.
  • Events : Push, Pull Request, Issues, Releases.

À chaque PR créée/mergée, message dans #dev avec lien.

Intégration Grafana Alerts

Grafana → Alerting → Contact points → New → type Webhook. URL : webhook Mattermost. Format JSON Mattermost-compatible :

{
  "text": "🚨 **{{ .CommonLabels.alertname }}** {{ .Status }}\n{{ .CommonAnnotations.summary }}",
  "channel": "alerts"
}

Toute alert Grafana (SLO breach, latence p99 > 500ms) post dans #alerts.

Intégration Uptime Kuma

Settings monitor → Notifications → Add → Mattermost. URL webhook + channel. Pour chaque DOWN ou UP, message immédiat.

{
  "text": "🔴 **{{monitorJSON.name}}** is DOWN\nReason: {{ msg }}"
}

Intégration Wave Mobile Money

Wave Business webhook → URL endpoint custom (votre VPS). Endpoint validate signature puis post Mattermost :

// app/api/wave-webhook/route.ts (Next.js)
import { verify } from 'crypto';

export async function POST(req: Request) {
  const body = await req.text();
  const sig = req.headers.get('Wave-Signature');
  if (!verify(body, sig, process.env.WAVE_SECRET)) {
    return new Response('Invalid', { status: 401 });
  }
  const data = JSON.parse(body);
  if (data.type === 'checkout.session.completed') {
    await fetch(process.env.MATTERMOST_WEBHOOK!, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        text: `💰 Paiement Wave reçu : ${data.amount} XOF de ${data.customer_phone}`,
        channel: 'sales'
      })
    });
  }
  return new Response('OK');
}

Slash commands custom

Profile → Integrations → Slash Commands → Add. Exemple /standup qui demande à chacun ses 3 lignes :

  • Command : standup.
  • Method : POST.
  • Request URL : https://api.votre-entreprise.com/standup.
  • Response Type : in-channel ou ephemeral.
// API endpoint /standup
export async function POST(req: Request) {
  const formData = await req.formData();
  const username = formData.get('user_name');
  return Response.json({
    response_type: 'in_channel',
    text: `📝 Standup de ${username}: ...`,
    attachments: [{
      actions: [{
        name: 'Hier', integration: { url: '...' }
      }]
    }]
  });
}

Bots custom (Plugins)

Pour bots avancés, plugin Mattermost en Go ou JavaScript. System Console → Plugins → Upload. Plugin lit/écrit messages, réagit à mentions, exécute commandes.

Exemples plugins officiels : Welcome Bot (onboarding new users), Standup, Polls, Webhooks (proxy).

Erreurs fréquentes

Erreur Cause Solution
Webhook 404 URL mal copiée Vérifier hooks/… format
Message en clair sans markdown Format JSON sans "text" Toujours wrapper dans {"text":"..."}
Channel inexistant Lock to channel ON empêche override Désactiver lock ou cibler bon channel
Webhook sortant ne déclenche pas Trigger word manquant Définir trigger word dans config
Bot ne lit pas messages Permissions plugin insuffisantes System Console permissions
Rate limit Mattermost > 30 req/sec Batch via queue

Adaptation au contexte ouest-africain

Trois précisions. Webhooks Mobile Money : Wave, Orange Money, Free Money offrent webhooks signés. Toujours vérifier signature avant poster Mattermost (sinon spam possible). Notifications client : channel #client-X dédié pour mises à jour automatisées (build deploy, monitoring). Bot Astreinte : bot mention @on-call route vers la personne d’astreinte selon planning Postgres.

Tutoriels frères

FAQ

Webhooks IPv6 ? Oui, Mattermost répond IPv4 et IPv6.

Limites webhooks ? 30 req/sec par webhook. Throttle si plus.

Bots multi-channel ? Oui, un bot peut poster dans plusieurs channels.

Bots écrire en DM ? Oui, via API si bot a permission.

Plugins Slack compatibles ? Non. Mais équivalents existants.

Pour aller plus loin

Besoin d'un site web ?

Confiez-nous la Création de Votre Site Web

Site vitrine, e-commerce ou application web — nous transformons votre vision en réalité digitale. Accompagnement personnalisé de A à Z.

À partir de 250.000 FCFA
Parlons de Votre Projet
Publicité