Skip to content

Commit 83fcbf2

Browse files
author
Tom Softreck
committed
update
1 parent 48ff509 commit 83fcbf2

16 files changed

Lines changed: 517 additions & 79 deletions

README.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -564,18 +564,12 @@ routes:
564564
confidence_threshold: 0.6
565565
target_objects: ["person", "car"]
566566

567-
# Go: Risk analysis
568-
- type: "external"
569-
command: "go run scripts/image_processor.go"
570-
config:
571-
threat_threshold: 0.7
572-
573567
# Filter high-risk only
574568
- type: "filter"
575569
condition: "{{threat_level}} == 'high'"
576570

577571
to:
578-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{SECURITY_EMAIL}}"
572+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{SECURITY_EMAIL}}"
579573
- "http://webhook.company.com/security-alert"
580574
```
581575
@@ -611,7 +605,7 @@ dialogchain run -c my_config.yaml --dry-run
611605
2. filter
612606
3. transform
613607
To:
614-
email://:?user=&password=&to=
608+
smtp://:?user=&password=&to=
615609
```
616610

617611
## 📖 Detailed Usage
@@ -694,7 +688,7 @@ processors:
694688
695689
| Destination | Example URL | Description |
696690
| ----------- | -------------------------------------------------------------------------- | --------------- |
697-
| Email | `email://smtp.gmail.com:587?user={{USER}}&password={{PASS}}&to={{EMAILS}}` | SMTP alerts |
691+
| Email | `smtp://smtp.gmail.com:587?user={{USER}}&password={{PASS}}&to={{EMAILS}}` | SMTP alerts |
698692
| HTTP | `http://api.company.com/webhook` | REST API calls |
699693
| MQTT | `mqtt://broker:1883/alerts/camera` | MQTT publishing |
700694
| File | `file:///logs/alerts.log` | File logging |
@@ -713,7 +707,6 @@ dialogchain/
713707
│ └── connectors.py # Input/output connectors
714708
├── scripts/ # External processors
715709
│ ├── detect_objects.py # Python: YOLO detection
716-
│ ├── image_processor.go # Go: Risk analysis
717710
│ ├── health_check.go # Go: Health monitoring
718711
│ └── business_rules.js # Node.js: Business logic
719712
├── examples/ # Configuration examples

docs/examples.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ routes:
4848
Daily System Report
4949
Generated: {{timestamp}}
5050
Status: System operational
51-
to: "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ADMIN_EMAIL}}"
51+
to: "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ADMIN_EMAIL}}"
5252

5353
env_vars:
5454
- SMTP_SERVER
@@ -166,7 +166,7 @@ routes:
166166
condition: "{{risk_score}} > 0.7"
167167

168168
to:
169-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{SECURITY_TEAM}}"
169+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{SECURITY_TEAM}}"
170170
- "http://{{SECURITY_API}}/alerts/critical"
171171

172172
# Parking lot camera - medium security
@@ -317,7 +317,7 @@ routes:
317317
{{/recommendations}}
318318
319319
to:
320-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{FACILITY_MANAGER}}"
320+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{FACILITY_MANAGER}}"
321321
- "http://{{BUILDING_MANAGEMENT_API}}/environmental/alerts"
322322

323323
env_vars:
@@ -369,7 +369,7 @@ routes:
369369

370370
to:
371371
- "http://{{MAINTENANCE_API}}/work-orders"
372-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{MAINTENANCE_TEAM}}"
372+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{MAINTENANCE_TEAM}}"
373373

374374
env_vars:
375375
- MQTT_BROKER
@@ -492,7 +492,7 @@ routes:
492492
monitoring: true
493493

494494
to:
495-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ML_TEAM}}"
495+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ML_TEAM}}"
496496
- "http://{{MODEL_REGISTRY}}/models/register"
497497

498498
env_vars:
@@ -553,7 +553,7 @@ routes:
553553
tracking_enabled: true
554554

555555
to:
556-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{customer_email}}"
556+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{customer_email}}"
557557
- "http://{{CRM_API}}/orders/update"
558558
- "mqtt://{{MQTT_BROKER}}:1883/orders/fulfilled"
559559

@@ -612,7 +612,7 @@ routes:
612612

613613
to:
614614
- "http://{{WORKFLOW_API}}/documents/route"
615-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{approver_email}}"
615+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{approver_email}}"
616616

617617
env_vars:
618618
- EXTRACTION_RULES
@@ -954,7 +954,7 @@ routes:
954954

955955
to:
956956
- "file:///reports/analytics_{{timestamp}}.html"
957-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ANALYTICS_TEAM}}"
957+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ANALYTICS_TEAM}}"
958958

959959
env_vars:
960960
- MQTT_BROKER
@@ -1162,7 +1162,7 @@ routes:
11621162
condition: "{{test_status}} == 'failed' or {{coverage}} < 80"
11631163

11641164
to:
1165-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{DEV_TEAM}}"
1165+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{DEV_TEAM}}"
11661166
- "http://{{TEST_REPORTING_API}}/results"
11671167

11681168
env_vars:

email.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Email Invoice Processor Configuration
2+
# Uses URL-style configuration with .env variable support
3+
4+
routes:
5+
- name: "email_invoice_processor"
6+
description: "Process email attachments for invoices"
7+
8+
# Source configuration (IMAP server)
9+
from: "imap://{{EMAIL_USER}}:{{EMAIL_PASSWORD}}@{{EMAIL_SERVER}}:{{EMAIL_PORT}}/INBOX"
10+
11+
# Processors configuration
12+
processors:
13+
# Step 1: Filter emails from specific month
14+
- type: "filter"
15+
condition: "{{date|date('%Y-%m')}} == '{{YEAR|default(now|date('%Y'))}}-{{'%02d'|format(MONTH|default(now.month))}}'"
16+
17+
# Step 2: Extract attachments
18+
- type: "external"
19+
command: "python -m email_invoice_processor.processor"
20+
input_format: "email"
21+
output_format: "json"
22+
config:
23+
output_dir: "{{OUTPUT_DIR|default('./output')}}"
24+
supported_extensions: [".pdf", ".jpg", ".jpeg", ".png"]
25+
26+
# Step 3: Process PDFs with local OCR
27+
- type: "local_ocr"
28+
engine: "tesseract"
29+
config:
30+
tesseract_cmd: "{{TESSERACT_CMD|default('tesseract')}}"
31+
languages: ["eng", "pol"]
32+
dpi: 300
33+
oem: 1 # LSTM + Legacy OCR Engine
34+
psm: 6 # Assume a single uniform block of text
35+
# Local processing flags
36+
use_gpu: false
37+
max_threads: 4
38+
temp_dir: "/tmp/ocr_processing"
39+
40+
# Error handling
41+
error_handlers:
42+
- type: "retry"
43+
max_attempts: 3
44+
delay: 5 # seconds
45+
46+
- type: "notify"
47+
to: "smtp://{{ADMIN_EMAIL}}"
48+
template: |
49+
Subject: Invoice Processing Failed
50+
51+
Error processing email: {{error}}
52+
53+
Details:
54+
{{error_details}}
55+
56+
# Output configuration
57+
to:
58+
- "file://{{OUTPUT_DIR|default('./output')}}/processed/{{date|date('%Y-%m')}}/{{message_id}}.json"
59+
- "smtp://{{REPORT_EMAIL}}?subject=Processed Invoice {{date|date('%Y-%m')}}"
60+
61+
# Global configuration
62+
config:
63+
log_level: "{{LOG_LEVEL|default('INFO')}}"
64+
log_file: "{{LOG_FILE|default('email_processor.log')}}"
65+
66+
# Email polling interval in seconds
67+
poll_interval: 300 # 5 minutes
68+
69+
# Maximum number of emails to process in one batch
70+
batch_size: 50
71+
72+
# Archive processed emails (move to another folder)
73+
archive_processed: true
74+
archive_folder: "Processed_Invoices"

examples/camera.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ routes:
1919
• Immediate Response Required: {{business_context.requires_immediate_response}}
2020
2121
to:
22-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}"
22+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}"
2323
# - "http://{{SECURITY_WEBHOOK}}/critical-alert"
2424
# - "mqtt://{{MQTT_BROKER}}:1883/security/alerts/{{CAMERA_NAME}}"
2525
- "log://logs/security_{{CAMERA_NAME}}.log"
@@ -38,7 +38,7 @@ routes:
3838
- type: "filter"
3939
condition: "{{status}} != 'healthy'"
4040

41-
to: "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}"
41+
to: "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}"
4242

4343

4444
env_vars:

examples/camera2.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ routes:
7272
• Immediate Response Required: {{business_context.requires_immediate_response}}
7373
7474
to:
75-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{SECURITY_EMAIL}}"
75+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{SECURITY_EMAIL}}"
7676
- "http://{{SECURITY_WEBHOOK}}/critical-alert"
7777
- "mqtt://{{MQTT_BROKER}}:1883/security/alerts/{{CAMERA_NAME}}"
7878
- "log://logs/security_{{CAMERA_NAME}}.log"
@@ -91,7 +91,7 @@ routes:
9191
- type: "filter"
9292
condition: "{{status}} != 'healthy'"
9393

94-
to: "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ADMIN_EMAIL}}"
94+
to: "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ADMIN_EMAIL}}"
9595

9696
- name: "motion_detection_backup"
9797
from: "rtsp://{{CAMERA_USER}}:{{CAMERA_PASS}}@{{CAMERA_IP}}/stream1"

examples/email.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ routes:
4343
Timestamp: {{ now()|datetime }}
4444
4545
to:
46-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}&subject=📷 Camera Health Alert"
46+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}&subject=📷 Camera Health Alert"
4747
- "log://logs/security_{{CAMERA_NAME}}.log"
4848

4949

examples/emaill.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ routes:
33
from: "timer://5s"
44
to:
55
- "log:info"
6-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}&subject=Test Email {{ now().strftime('%H:%M:%S') }}"
6+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}&subject=Test Email {{ now().strftime('%H:%M:%S') }}"
77

88
# Required environment variables
99
env_vars:

examples/emailog.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ routes:
1212
}
1313
1414
to:
15-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}&subject=Log Message {{ now().strftime('%H:%M:%S') }}"
15+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}&subject=Log Message {{ now().strftime('%H:%M:%S') }}"
1616
- "log:info"
1717

1818
# Required environment variables

examples/emails.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ routes:
33
from: "timer://5s"
44
to:
55
- "log:info"
6-
- "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}&subject=Test Email"
6+
- "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ALERT_EMAIL}}&subject=Test Email"
77

88
# Required environment variables
99
env_vars:

examples/grpc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ routes:
6868
Latency: {{latency_ms}}ms
6969
Error Rate: {{error_rate}}%
7070
71-
to: "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ML_TEAM_EMAIL}}"
71+
to: "smtp://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ML_TEAM_EMAIL}}"
7272

7373
- name: "distributed_batch_processing"
7474
from: "file:///data/batch_queue/*.json"

0 commit comments

Comments
 (0)