0% found this document useful (0 votes)
10 views3 pages

Project Alert Email to Task Automation

vvit

Uploaded by

gowtham.b.vvit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Project Alert Email to Task Automation

vvit

Uploaded by

gowtham.b.vvit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

{

"name": "Project Alert Email to Task (ChatGPT)",


"nodes": [
{
"id": "1",
"name": "Read Email (IMAP)",
"type": "[Link]",
"typeVersion": 1,
"position": [200, 300],
"credentials": {
"imap": {
"id": "your-imap-credential-id",
"name": "Your IMAP Credentials"
}
},
"parameters": {
"mailbox": "INBOX",
"downloadAttachments": false,
"options": {
"markAsSeen": true
}
}
},
{
"id": "2",
"name": "Filter Project Alerts",
"type": "[Link]",
"typeVersion": 1,
"position": [400, 300],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json[\"from\"]}}",
"operation": "contains",
"value2": "project1234email@[Link]"
}
]
}
}
},
{
"id": "3",
"name": "Prepare GPT Prompt",
"type": "[Link]",
"typeVersion": 1,
"position": [600, 300],
"parameters": {
"functionCode": "const subject = $[Link] || '';\nconst body =
$[Link] || $[Link] || '';\nreturn [{\n json: {\n prompt: `You are an
assistant that extracts structured tasks from alert emails from a Raspberry Pi-
based manhole monitoring system.\\n\\nConvert the following alert email into a
structured task object with:\\n- task\\n- due_date (use timestamp in the subject or
say 'asap')\\n- location (extract manhole number)\\n- priority (high for
gas/overflow/temp/flow, medium for level)\\n- alert_type\\n\\nEmail Subject: $
{subject}\\n\\nEmail Body: ${body}`\n }\n}];"
}
},
{
"id": "4",
"name": "ChatGPT (OpenAI API)",
"type": "[Link]",
"typeVersion": 1,
"position": [800, 300],
"parameters": {
"url": "[Link]
"method": "POST",
"authentication": "headerAuth",
"responseFormat": "json",
"headerParametersUi": {
"parameter": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer YOUR_OPENAI_API_KEY"
}
]
},
"bodyParametersJson": {
"model": "gpt-3.5-turbo",
"messages": [
{ "role": "system", "content": "You are a helpful assistant that turns
Pi alert emails into tasks." },
{ "role": "user", "content": "{{$json[\"prompt\"]}}" }
],
"temperature": 0.3
}
}
},
{
"id": "5",
"name": "Parse GPT Task JSON",
"type": "[Link]",
"typeVersion": 1,
"position": [1000, 300],
"parameters": {
"functionCode": "const response = $[Link][0].[Link];\ntry {\
n const task = [Link](response);\n return [{ json: task }];\n} catch (e) {\n
return [{ json: { error: 'Failed to parse GPT output', raw: response } }];\n}"
}
}
],
"connections": {
"Read Email (IMAP)": {
"main": [[{ "node": "Filter Project Alerts", "type": "main", "index": 0 }]]
},
"Filter Project Alerts": {
"main": [[{ "node": "Prepare GPT Prompt", "type": "main", "index": 0 }]]
},
"Prepare GPT Prompt": {
"main": [[{ "node": "ChatGPT (OpenAI API)", "type": "main", "index": 0 }]]
},
"ChatGPT (OpenAI API)": {
"main": [[{ "node": "Parse GPT Task JSON", "type": "main", "index": 0 }]]
}
},
"active": false
}

You might also like