- docker-compose: n8n container (port 5678) with PostgreSQL backend - n8n/: 7 TypeScript workflow files + import script + README - Workflows: 4 CMS BI data ingestion + 3 email reports - README: updated with n8n env vars and port - .dockerignore: exclude import.sh from container
38 lines
1.4 KiB
Markdown
38 lines
1.4 KiB
Markdown
# n8n Workflows
|
|
|
|
Included in the Docker deployment. Workflows mount at `/workflows/`.
|
|
|
|
## After first boot
|
|
|
|
1. Open http://localhost:5678 and create your owner account
|
|
2. Go to **Settings → n8n API** → Generate an API key
|
|
3. Create these credentials in n8n:
|
|
|
|
| Credential Name | Type | Config |
|
|
|-----------------|------|--------|
|
|
| `jetour-bi-remote` | PostgreSQL | Host: `db`, Port: `5432`, DB: `jetour-bi`, User: `jetour`, Password: (your DB_PASSWORD) |
|
|
| `jetour-smtp` | SMTP | Your email server details |
|
|
|
|
4. Import workflows:
|
|
```bash
|
|
docker compose exec n8n sh /workflows/import.sh
|
|
```
|
|
|
|
## Workflows
|
|
|
|
| File | Trigger | What it does |
|
|
|------|---------|-------------|
|
|
| `wf1_prospects_created.ts` | 02:00 SAST | Fetch new prospects from CMS BI API |
|
|
| `wf2_prospects_updated.ts` | 02:10 SAST | Fetch prospect changes from CMS BI |
|
|
| `wf3_otps_created.ts` | 02:20 SAST | Fetch new OTPs from CMS BI |
|
|
| `wf4_otps_updated.ts` | 02:50 SAST | Fetch OTP changes from CMS BI |
|
|
| `wf_email_daily.ts` | 07:00 SAST | POST /api/send-report/daily → email |
|
|
| `wf_email_weekly.ts` | Mon 07:00 | POST /api/send-report/weekly → email |
|
|
| `wf_email_monthly.ts` | 1st 07:00 | POST /api/send-report/monthly → email |
|
|
|
|
## Manual import (alternative)
|
|
|
|
If the script fails, use n8n's built-in import in the UI:
|
|
1. Go to **Workflows → Import from File**
|
|
2. Select each `.ts` file in this directory
|