n8n
Workflow
Nathan Your N8n Personal Assistant
This n8n workflow automates tasks and integrates with various services. Nathan Your N8n Personal Assistant - ready to import and run in your n8n instance.
n8n
workflow.json
About This Script
This n8n workflow automates tasks and integrates with various services. Nathan Your N8n Personal Assistant - ready to import and run in your n8n instance.
Features:
- Conditional logic and branching
- Custom JavaScript function processing
Source Code
{
"nodes": [
{
"name": "Read Harvey's Email",
"type": "n8n-nodes-base.emailReadImap",
"position": [
270,
390
],
"parameters": {
"options": []
},
"credentials": {
"imap": "Read Harvey's Mail"
},
"typeVersion": 1,
"id": "ef275e21-d559-4cfd-be25-57a3e2adb141"
},
{
"name": "Who Is The Email From?",
"type": "n8n-nodes-base.switch",
"position": [
460,
390
],
"parameters": {
"rules": {
"rules": [
{
"value2": "Louis Litt <louis_litt_1970@yahoo.com>"
}
]
},
"value1": "={{$node[\"Read Harvey's Email\"].json[\"from\"]}}",
"dataType": "string",
"fallbackOutput": 3
},
"typeVersion": 1,
"alwaysOutputData": false,
"id": "6e939c40-4427-41f4-8f68-f1f996fc3ef6"
},
{
"name": "Read Excuses File",
"type": "n8n-nodes-base.readBinaryFile",
"position": [
670,
230
],
"parameters": {
"filePath": "/home/n8n/Excuse_Generator.xlsx"
},
"typeVersion": 1,
"id": "e61b77f3-fdc1-4871-9af4-570857a36a87"
},
{
"name": "Retrieve Excuses Spreadsheet Data",
"type": "n8n-nodes-base.spreadsheetFile",
"position": [
860,
230
],
"parameters": {
"options": []
},
"typeVersion": 1,
"id": "54ac3e76-cd74-49df-9795-dc39128bd8a7"
},
{
"name": "Generate Excuse",
"type": "n8n-nodes-base.function",
"position": [
1040,
230
],
"parameters": {
"functionCode": "var leadinmax = 24;\nvar perpmax = 25;\nvar delaymax = 23;\nvar leadin = Math.floor((Math.random() * leadinmax ) + 1);\nvar perp = Math.floor((Math.random() * perpmax ) + 1);\nvar delay = Math.floor((Math.random() * delaymax) + 1);\n\nvar excuse = items[leadin].json.Leadin + \" \" + items[perp].json.Perpetrator + \" \" + items[delay].json.Delay;\n\nitems = [{json:{}}];\n\nitems[0].json.excuse = excuse;\nreturn items;\n"
},
"typeVersion": 1,
"id": "b320d254-ddcd-4dcd-9e11-01ab3145a03b"
},
{
"name": "Merge Excuse and Mail Data",
"type": "n8n-nodes-base.merge",
"position": [
1230,
330
],
"parameters": {
"mode": "mergeByIndex"
},
"typeVersion": 1,
"id": "d0e5e2e7-e98c-4959-8298-b0bdba390290"
},
{
"name": "Send Email",
"type": "n8n-nodes-base.emailSend",
"position": [
1460,
250
],
"parameters": {
"text": "= {{$node[\"Merge Excuse and Mail Data\"].json[\"excuse\"]}}\n\nMaybe next time.\n\nHarvey",
"options": [],
"subject": "=RE: {{$node[\"Merge Excuse and Mail Data\"].json[\"subject\"]}}",
"toEmail": "={{$node[\"Merge Excuse and Mail Data\"].json[\"from\"]}}",
"fromEmail": "={{$node[\"Merge Excuse and Mail Data\"].json[\"to\"]}}"
},
"credentials": {
"smtp": "Send Harvey's Mail"
},
"typeVersion": 1,
"id": "fcfc811a-273a-4183-bd09-fe369b337af5"
},
{
"name": "Slack (Louis)",
"type": "n8n-nodes-base.slack",
"position": [
1470,
410
],
"parameters": {
"text": "=Here is what Louis emailed you:\n```\n{{$node[\"Merge Excuse and Mail Data\"].json[\"textPlain\"]}}\n```\n\nHere is how \"you\" responded:\n> {{$node[\"Merge Excuse and Mail Data\"].json[\"excuse\"]}}\n\n:+1: *You're Welcome!* :smirk:",
"channel": "private",
"attachments": [],
"otherOptions": {
"mrkdwn": true
}
},
"credentials": {
"slackApi": "Nathan's Slack API Token"
},
"typeVersion": 1,
"id": "30213354-f767-4b5f-bbf8-77b9a7696c9e"
},
{
"name": "Slack (General)",
"type": "n8n-nodes-base.slack",
"position": [
890,
470
],
"parameters": {
"text": "You've just received an email. You may wish to check it out.",
"channel": "private",
"attachments": [],
"otherOptions": {
"mrkdwn": true
}
},
"credentials": {
"slackApi": "Nathan's Slack API Token"
},
"typeVersion": 1,
"id": "af308691-5265-4f38-9eec-329d5f4e9a9a"
}
],
"connections": {
"Generate Excuse": {
"main": [
[
{
"node": "Merge Excuse and Mail Data",
"type": "main",
"index": 0
}
]
]
},
"Read Excuses File": {
"main": [
[
{
"node": "Retrieve Excuses Spreadsheet Data",
"type": "main",
"index": 0
}
]
]
},
"Read Harvey's Email": {
"main": [
[
{
"node": "Who Is The Email From?",
"type": "main",
"index": 0
}
]
]
},
"Who Is The Email From?": {
"main": [
[
{
"node": "Read Excuses File",
"type": "main",
"index": 0
},
{
"node": "Merge Excuse and Mail Data",
"type": "main",
"index": 1
}
],
[
{
"node": "Slack (General)",
"type": "main",
"index": 0
}
]
]
},
"Merge Excuse and Mail Data": {
"main": [
[
{
"node": "Send Email",
"type": "main",
"index": 0
},
{
"node": "Slack (Louis)",
"type": "main",
"index": 0
}
]
]
},
"Retrieve Excuses Spreadsheet Data": {
"main": [
[
{
"node": "Generate Excuse",
"type": "main",
"index": 0
}
]
]
}
},
"n8n_version": "1.5.0"
}
Requirements
n8n instance, Slack API credentials
Tags
#n8n
#automation
#workflow