-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemail-inbox-triage.yaml
More file actions
64 lines (59 loc) · 1.77 KB
/
Copy pathemail-inbox-triage.yaml
File metadata and controls
64 lines (59 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: email-inbox-triage
description: >
AI-powered email triage: reads new emails, classifies them,
moves to appropriate folders, and flags important ones.
triggers:
- type: email
mailbox: company-inbox
folder: INBOX
filter: unseen
poll_interval: 30s
steps:
- name: classify
action: ai/completion
credential: openai-key
params:
model: gpt-4o
system_prompt: >
Classify this email into one of: important, actionable, newsletter, spam.
Respond with JSON: {"category": "...", "summary": "...", "priority": "high|medium|low"}
prompt: |
From: {{ trigger.from }}
Subject: {{ trigger.subject }}
Body: {{ trigger.body }}
output_schema:
type: object
properties:
category:
type: string
enum: [important, actionable, newsletter, spam]
summary:
type: string
priority:
type: string
enum: [high, medium, low]
required: [category, summary, priority]
- name: flag-important
action: email/flag
credential: company-inbox
if: "steps.classify.output.json.priority == 'high'"
params:
uid: "{{ trigger.uid }}"
flags: ["flagged", "important"]
action: add
- name: move-to-folder
action: email/move
credential: company-inbox
params:
uid: "{{ trigger.uid }}"
target_folder: "{{ steps.classify.output.json.category }}"
- name: notify-important
action: slack/send
credential: slack-token
if: "steps.classify.output.json.priority == 'high'"
params:
channel: "#important-emails"
text: |
New important email from {{ trigger.from }}:
Subject: {{ trigger.subject }}
Summary: {{ steps.classify.output.json.summary }}