Website Lead Notification
1. Quoi ? — Définition et contexte
Section intitulée « 1. Quoi ? — Définition et contexte »Le workflow Website Lead Notification notifie instantanément les admins sur Telegram dès qu’un visiteur remplit le formulaire de contact Odoo. L’opportunité CRM est créée automatiquement côté Odoo, et N8N envoie un message formaté avec les détails du prospect.
Flux de données
Section intitulée « Flux de données »| Étape | Composant | Action |
|---|---|---|
| 1 | Formulaire Odoo | Visiteur soumet le formulaire contactus |
| 2 | Odoo CRM | Crée automatiquement une opportunité |
| 3 | Automated Action | Détecte le nouveau lead (medium=Website) |
| 4 | Webhook Odoo | Envoie les données à N8N (réseau interne) |
| 5 | N8N Workflow | Formate et route vers Telegram |
2. Pourquoi ? — Enjeux et motivations
Section intitulée « 2. Pourquoi ? — Enjeux et motivations »Problèmes résolus
Section intitulée « Problèmes résolus »| Problème | Sans ce workflow | Avec ce workflow |
|---|---|---|
| Délai de réponse | Découverte du lead le lendemain | Notification instantanée |
| Leads manqués | Oubli de vérifier le CRM | Push sur le mobile |
| Contexte perdu | Retourner dans Odoo pour voir les détails | Toutes les infos dans Telegram |
Pourquoi utiliser un webhook interne ?
Section intitulée « Pourquoi utiliser un webhook interne ? »| Approche | Avantage | Inconvénient |
|---|---|---|
| Webhook interne (Docker) | Sécurisé, pas d’auth nécessaire | Uniquement pour services Docker |
| Polling API Odoo | Plus simple à configurer | Latence, charge serveur |
| Webhook externe | Accessible partout | Nécessite auth + TLS |
3. Comment ? — Mise en œuvre technique
Section intitulée « 3. Comment ? — Mise en œuvre technique »Architecture
Section intitulée « Architecture »Formulaire Web Odoo (contactus) │ ▼ crm.lead créé (Create an Opportunity) │ ▼ Automated Action Odoo (trigger: Lors de l'enregistrement) (filtre: medium_id = Website) │ ▼ Webhook intégré Odoo │ HTTP POST (Docker internal) ▼ N8N Webhook /odoo/website-lead (http://n8n:5678 - internal only) │ ▼ Notification Hub → Telegram adminsSécurité du webhook
Section intitulée « Sécurité du webhook »| Aspect | Configuration |
|---|---|
| URL interne | http://n8n:5678/webhook/odoo/website-lead |
| Accès externe | Bloqué par Caddy (403 Forbidden) |
| Authentification | Aucune (trafic interne Docker) |
Configuration Caddy :
@internal_webhooks { path /webhook/notify/* path /webhook/prometheus/* path /webhook/odoo/*}handle @internal_webhooks { respond "Forbidden" 403}Configuration Odoo
Section intitulée « Configuration Odoo »Menu: Settings → Technical → Automation → Automated Actions
| Champ | Valeur |
|---|---|
| Nom | N8N: Notify on Website Lead |
| Modèle | Piste/opportunité (crm.lead) |
| Déclencheur | Lors de l'enregistrement |
| Appliquer sur | [('medium_id.name', '=', 'Website')] |
| Action | Envoyer une notification webhook |
| URL | http://n8n:5678/webhook/odoo/website-lead |
Champs envoyés :
name— Nom de l’opportunitécontact_name— Nom du contactemail_from— Emailphone— Téléphonepartner_name— Nom entreprisedescription— Message du formulaire
Configuration N8N
Section intitulée « Configuration N8N »Node Format Lead (Code) :
const lead = $json.body;
const message = `👤 Contact: ${lead.contact_name || lead.name || 'Non renseigné'}🏢 Entreprise: ${lead.partner_name || 'Non renseignée'}📧 Email: ${lead.email_from || 'Non renseigné'}📱 Téléphone: ${lead.phone || lead.mobile || 'Non renseigné'}
💬 Message:${lead.description ? lead.description.substring(0, 500) : 'Aucune description'}
📋 https://odoo.guigpap.com/odoo/crm/${lead._id}`;
return { json: { source: "odoo_website_form", type: "new_lead", severity: "info", title: `🌐 Nouvelle opportunité: ${lead.contact_name || lead.name}`, message: message, timestamp: new Date().toISOString(), hasCallback: false }};Commandes de test
Section intitulée « Commandes de test »# Test du webhook depuis Odoodocker exec odoo curl -s -X POST \ "http://n8n:5678/webhook/odoo/website-lead" \ -H "Content-Type: application/json" \ -d '{ "_id": 999, "_model": "crm.lead", "name": "Test Lead", "contact_name": "Jean Dupont", "email_from": "jean@test.com", "phone": "+33 6 12 34 56 78", "partner_name": "Entreprise Test", "description": "Message de test" }'# Attendu: {"status": "ok"} + notification Telegram
# Vérifier la connectivité Dockerdocker exec odoo curl -s http://n8n:5678/healthz4. Et si ? — Perspectives et limites
Section intitulée « 4. Et si ? — Perspectives et limites »Limites actuelles
Section intitulée « Limites actuelles »| Limite | Impact | Mitigation |
|---|---|---|
| Webhook unidirectionnel | Pas de confirmation de lecture | Lien vers Odoo dans le message |
| Pas de réponse depuis Telegram | Retour manuel dans Odoo | Prévu : boutons d’action |
| Dépendance N8N | Pas de notif si N8N down | Monitoring container N8N |
Scénarios d’évolution
Section intitulée « Scénarios d’évolution »Si besoin de répondre depuis Telegram :
- Ajouter des boutons inline (Assigner, Qualifier, Appeler)
- Callback vers Odoo pour mettre à jour le lead
- Notification de confirmation
Si volume de leads augmente :
- Filtrage par score lead
- Rotation des assignations
- Digest horaire au lieu d’instantané
Si besoin de multi-canal :
- Ajouter ntfy comme backup
- Notification email pour leads VIP
- Intégration Slack si équipe
Troubleshooting
Section intitulée « Troubleshooting »| Problème | Vérification |
|---|---|
| Pas de notification | N8N: workflow actif ? Notification Hub exécuté ? |
| Webhook timeout | docker exec odoo curl http://n8n:5678/healthz |
| Données manquantes | Vérifier champs sélectionnés dans Odoo webhook |
| Quiet hours | Notification différée si 22h-7h (sauf severity=critical) |
Pages liées
Section intitulée « Pages liées »Workflows
Section intitulée « Workflows »- Notification Hub — Routage vers Telegram
- Cal.com → Odoo CRM — Sync rendez-vous
Infrastructure
Section intitulée « Infrastructure »- Security Stack — Configuration Caddy
- Odoo 18 sur Docker — Configuration ERP