mirror of
https://github.com/R0m1k3/n8n-Agent.git
synced 2026-10-15 03:06:31 +02:00
227 lines
4.9 KiB
Markdown
227 lines
4.9 KiB
Markdown
# Workflows N8N
|
|
|
|
Ce dossier contient vos workflows N8N créés et modifiés par l'agent consultant.
|
|
|
|
## Organisation Recommandée
|
|
|
|
```
|
|
workflows/
|
|
├── README.md # Ce fichier
|
|
├── production/ # Workflows en production
|
|
│ ├── workflow-name.json
|
|
│ └── workflow-name.backup.json
|
|
├── development/ # Workflows en développement
|
|
│ └── test-workflow.json
|
|
├── templates/ # Templates réutilisables
|
|
│ ├── webhook-pattern.json
|
|
│ ├── api-pattern.json
|
|
│ └── ai-pattern.json
|
|
└── archives/ # Anciens workflows
|
|
└── old-workflow.json
|
|
```
|
|
|
|
## Bonnes Pratiques
|
|
|
|
### Naming Convention
|
|
```
|
|
[type]-[description]-[version].json
|
|
|
|
Exemples :
|
|
- webhook-form-submission-v1.json
|
|
- scheduled-daily-report-v2.json
|
|
- api-customer-sync-v1.json
|
|
```
|
|
|
|
### Versioning
|
|
- Incrémentez la version à chaque modification majeure
|
|
- Gardez toujours un backup : `workflow-name.backup.json`
|
|
- Documentez les changements dans un fichier CHANGELOG.md
|
|
|
|
### Export depuis N8N
|
|
```bash
|
|
# Via l'interface N8N
|
|
Settings → Workflows → Export
|
|
|
|
# Via l'API (avec l'agent)
|
|
"Exporte le workflow ID 123 dans workflows/production/"
|
|
```
|
|
|
|
### Import vers N8N
|
|
```bash
|
|
# Via l'interface N8N
|
|
Workflows → Import
|
|
|
|
# Via l'API (avec l'agent)
|
|
"Importe le workflow workflows/development/test.json dans N8N"
|
|
```
|
|
|
|
## Structure d'un Workflow N8N
|
|
|
|
```json
|
|
{
|
|
"name": "Mon Workflow",
|
|
"nodes": [
|
|
{
|
|
"parameters": {},
|
|
"name": "Webhook",
|
|
"type": "n8n-nodes-base.webhook",
|
|
"position": [250, 300]
|
|
}
|
|
],
|
|
"connections": {},
|
|
"settings": {
|
|
"saveExecutionProgress": true,
|
|
"saveManualExecutions": true
|
|
}
|
|
}
|
|
```
|
|
|
|
## Commandes Utiles
|
|
|
|
### Créer un Nouveau Workflow
|
|
```
|
|
Crée un workflow [description] et sauvegarde-le dans workflows/development/
|
|
```
|
|
|
|
### Analyser un Workflow Local
|
|
```
|
|
Analyse le workflow dans workflows/development/test.json
|
|
et explique-moi ce qu'il fait
|
|
```
|
|
|
|
### Optimiser un Workflow Local
|
|
```
|
|
Optimise le workflow workflows/production/mon-workflow.json
|
|
et sauvegarde la version optimisée dans workflows/development/
|
|
```
|
|
|
|
### Convertir en Template
|
|
```
|
|
Convertis le workflow workflows/production/webhook-form.json
|
|
en template réutilisable dans workflows/templates/
|
|
```
|
|
|
|
## Sécurité
|
|
|
|
**⚠️ IMPORTANT ⚠️**
|
|
|
|
Les workflows peuvent contenir :
|
|
- Des API Keys
|
|
- Des URLs privées
|
|
- Des credentials N8N
|
|
- Des données sensibles
|
|
|
|
### Protection
|
|
1. Ajoutez `*.backup.json` dans `.gitignore`
|
|
2. Ne commitez JAMAIS les credentials
|
|
3. Utilisez les credentials N8N au lieu de hard-code
|
|
4. Sanitizez avant de partager
|
|
|
|
### Sanitization Rapide
|
|
```
|
|
Sanitize le workflow workflows/production/mon-workflow.json
|
|
en retirant toutes les données sensibles
|
|
```
|
|
|
|
## Backup Automatique
|
|
|
|
L'agent crée automatiquement des backups lors des modifications :
|
|
- `workflow-name.backup.json` : Version précédente
|
|
- `workflow-name.v1.json` : Version archivée
|
|
|
|
## Templates Disponibles
|
|
|
|
L'agent peut générer des templates basés sur les **5 patterns** :
|
|
|
|
1. **Webhook Pattern** : Réception et traitement de webhooks
|
|
2. **HTTP API Pattern** : Appels API avec retry
|
|
3. **Database Pattern** : CRUD et synchronisation
|
|
4. **AI Pattern** : Intégrations IA
|
|
5. **Scheduled Pattern** : Tâches planifiées
|
|
|
|
### Générer un Template
|
|
```
|
|
Crée un template pour le pattern [webhook/api/database/ai/scheduled]
|
|
et sauvegarde-le dans workflows/templates/
|
|
```
|
|
|
|
## Exemples de Workflows
|
|
|
|
### Webhook Simple
|
|
```json
|
|
{
|
|
"name": "Simple Webhook",
|
|
"nodes": [
|
|
{
|
|
"name": "Webhook",
|
|
"type": "n8n-nodes-base.webhook",
|
|
"parameters": {
|
|
"path": "my-webhook",
|
|
"method": "POST"
|
|
}
|
|
},
|
|
{
|
|
"name": "Respond",
|
|
"type": "n8n-nodes-base.respondToWebhook",
|
|
"parameters": {
|
|
"respondWith": "json",
|
|
"responseBody": "={{ { success: true } }}"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### API Schedule
|
|
```json
|
|
{
|
|
"name": "Hourly API Fetch",
|
|
"nodes": [
|
|
{
|
|
"name": "Schedule",
|
|
"type": "n8n-nodes-base.scheduleTrigger",
|
|
"parameters": {
|
|
"rule": {
|
|
"interval": [{ "field": "hours", "hoursInterval": 1 }]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "HTTP Request",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"parameters": {
|
|
"url": "https://api.example.com/data",
|
|
"method": "GET"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
## Commandes d'Import/Export
|
|
|
|
### Export depuis N8N
|
|
```
|
|
Exporte tous mes workflows actifs dans workflows/production/
|
|
```
|
|
|
|
### Import vers N8N
|
|
```
|
|
Importe tous les workflows de workflows/development/ vers N8N
|
|
```
|
|
|
|
### Sync Bidirectionnel
|
|
```
|
|
Synchronise les workflows entre N8N et workflows/production/
|
|
```
|
|
|
|
## Ressources
|
|
|
|
- **N8N Docs** : https://docs.n8n.io
|
|
- **Workflow Templates** : https://n8n.io/workflows
|
|
- **Community** : https://community.n8n.io
|
|
|
|
---
|
|
|
|
**Organisez vos workflows pour une meilleure productivité !**
|