Workflow: Notify_user_in_Slack_of_quarantined_email_and_create_Jira_ticket_if_opened
Integrations: code, httpRequest, if, jira, noOp, slack, stickyNote, webhook

{"id": "LSH4x5nnNGQbNBkh", "meta": {"instanceId": "workflow-6e41af4d", "versionId": "1.0.0", "createdAt": "2025-09-29T07:08:01.282155", "updatedAt": "2025-09-29T07:08:01.282173", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production"}, "name": "Notify_user_in_Slack_of_quarantined_email_and_create_Jira_ticket_if_opened", "tags": ["automation", "n8n", "production-ready", "excellent", "optimized"], "nodes": [{"id": "f0bf5f9b-58c5-4dff-95cc-3af378fc49a3", "name": "has email been opened?", "type": "n8n-nodes-base.if", "position": [1280, 1040], "parameters": {"conditions": {"boolean": [{"value1": "={{ !!($json.read_at ?? false) }}", "value2": true}]}}, "typeVersion": 1, "notes": "This if node performs automated tasks as part of the workflow."}, {"id": "7acb2409-6b67-4500-993f-5beeaecec718", "name": "Receive Sublime Security Alert", "type": "n8n-nodes-base.webhook", "position": [840, 1040], "webhookId": "3ea0b887-9caa-477e-b6e4-1d3edf72d11e", "parameters": {"path": "3ea0b887-9caa-477e-b6e4-1d3edf72d11e", "options": {}, "httpMethod": "POST", "authentication": "{{ $credentials.headerAuth }}"}, "credentials": {"httpHeaderAuth": {"id": "a9rnBXHOmqHidbGH", "name": "sublimesecurity.com - webhook calling n8n "}}, "typeVersion": 1, "notes": "This webhook node performs automated tasks as part of the workflow."}, {"id": "ad876000-e3a4-4f3e-b917-629cc450a15c", "name": "Get message details in Sublime Security", "type": "n8n-nodes-base.httpRequest", "position": [1040, 1040], "parameters": {"url": "{{ $env.BASE_URL }}", "options": {}, "authentication": "{{ $credentials.genericCredentialType }}", "genericAuthType": "httpHeaderAuth"}, "credentials": {"httpHeaderAuth": {"id": "Pc9hRVp3NXeK3XwV", "name": "sublimesecurity.com - API Key"}}, "typeVersion": 4.1, "notes": "This httpRequest node performs automated tasks as part of the workflow."}, {"id": "2945cdef-f595-410d-9344-767e8cae3cd6", "name": "Jira Software", "type": "n8n-nodes-base.jira", "position": [1680, 900], "parameters": {"project": {"__rl": true, "mode": "list", "value": ""}, "summary": "=Flagged email has been opened before quarantine | {{ $('Get message details in Sublime Security').item.json.subject }}", "issueType": {"__rl": true, "mode": "list", "value": ""}, "additionalFields": {"description": "=An email has been automatically flagged by Sublime Security and has been quarantined.\nThe recipient has opened the email before the quarantine occurred.\n\n## **Flagged Rules**\n|Name |Severity|Tags|ID|\n|--|--|--|--|\n{{ $json[\"table\"] }}\n\n## **Email information**\n| | |\n|--|--|\n|Email ID|{{ $('Get message details in Sublime Security').item.json[\"id\"] }}|\n|Time Created At|{{ $('Get message details in Sublime Security').item.json[\"created_at\"] }}|\n|Receiving Mailbox Address|{{ $('Get message details in Sublime Security').item.json[\"mailbox\"][\"email\"] }}|\n|Subject line|{{ $('Get message details in Sublime Security').item.json[\"subject\"] }}|\n|Sender Email|{{ $('Get message details in Sublime Security').item.json[\"sender\"][\"email\"] }}|\n|Sender Display Name|{{ $('Get message details in Sublime Security').item.json[\"sender\"][\"display_name\"] }}|\n|Time Read At|{{ $('Get message details in Sublime Security').item.json[\"read_at\"] }}|\n\nTo view the message details and further information, please check the Sublime Security dashboard.\n\nAn email has been sent to {{ $('Get message details in Sublime Security').item.json[\"mailbox\"][\"email\"] }} notifying them that an incoming message has been quarantined."}}, "credentials": {"jiraSoftwareCloudApi": {"id": "OYvpDV2Q42eY6iyA", "name": "Alex Jira Cloud"}}, "typeVersion": 1, "notes": "This jira node performs automated tasks as part of the workflow."}, {"id": "9c55d492-0fdd-4edd-995c-b3c5fecd9840", "name": "lookup slack user by email", "type": "n8n-nodes-base.httpRequest", "position": [1280, 460], "parameters": {"url": "{{ $env.API_BASE_URL }}", "options": {}, "sendQuery": true, "authentication": "{{ $credentials.predefinedCredentialType }}", "queryParameters": {"parameters": [{"name": "email", "value": "={{ $json.mailbox.email }}"}]}, "nodeCredentialType": "YOUR_CREDENTIAL_HERE"}, "credentials": {"slackApi": {"id": "{{ $credentials.slackApi.id }}", "name": "n8n License Token"}, "slackOAuth2Api": {"id": "{{ $credentials.slackOAuth2Api.id }}", "name": "n8n License Bot"}}, "typeVersion": 4.1, "notes": "This httpRequest node performs automated tasks as part of the workflow."}, {"id": "f1bcb2c7-4ef4-4f9b-a68e-6620ab66b435", "name": "user found?", "type": "n8n-nodes-base.if", "position": [1480, 460], "parameters": {"conditions": {"boolean": [{"value1": "={{ !!($json.user.id ?? false) }}", "value2": true}]}}, "typeVersion": 1, "notes": "This if node performs automated tasks as part of the workflow."}, {"id": "dcca54b8-d09c-45bf-a789-7545103bb7c3", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [480, 364.84681758846136], "parameters": {"width": 718.6188455173532, "height": 863.9601939404693, "content": "![Sublime Security]({{ $env.WEBHOOK_URL }}\n# Workflow Overview\n\nThis workflow is initiated by `Sublime Security` whenever an inbound email undergoes scanning and triggers an alert.\n\nIn the event that Sublime Security is set up to automatically quarantine the email, this workflow will make an effort to inform the recipient through Slack. To accomplish this, it will utilize the recipient's mailbox address to search for their corresponding Slack username.\n\nIf the flagged email has already been opened, this workflow will additionally create a Jira ticket to manage the incident.\n\n## **HTTP Request Node Requirements**\n1. Create a rule in Sublime Security which has [auto-quarantine enabled]({{ $env.WEBHOOK_URL }}\n2. [Create a webhook]({{ $env.WEBHOOK_URL }} in Sublime which will send an alert to the `Receive Sublime Security Alert` node whenever a selected rule is triggered.\n\n## **Credentials**\n- Sublime Security: Find your API key for [Sublime Security]({{ $env.API_BASE_URL }} and save it as an n8n credential with Header Auth in the format `Authorization: Bearer YOUR-API-KEY`.\n\n- Slack: Provide credentials for a Slack app that has access to `users:read.email` and `im:write` scopes.\n"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "8255a3f7-fcda-4d93-97c3-4d223778014f", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [1220, 175.18665303995851], "parameters": {"width": 714.4547337311393, "height": 522.7074838611178, "content": "![Slack]({{ $env.WEBHOOK_URL }}\n## Try to find quarantined email user's slack username \nWith the quarantined email\u2019s details at hand, n8n tries to notify the user via Slack. The message explains the reason for the email\u2019s absence, provides identifying details, and instructs on further action if the user recognizes the email as safe."}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "c149a4b8-4f12-4018-a1dc-dfbed9e081eb", "name": "Found, notify user", "type": "n8n-nodes-base.slack", "position": [1700, 400], "parameters": {"text": "=Hello,\nOur security team has detected a potentially malicious email sent to your inbox and have quarantined it undergoing investigation.\n\nFrom: {{ $('Get message details in Sublime Security').item.json[\"sender\"][\"display_name\"] }} | {{ $('Get message details in Sublime Security').item.json[\"sender\"][\"email\"] }}\nSubject: {{ $('Get message details in Sublime Security').item.json[\"subject\"] }}\n\nIf you believe that the email is not malicious and was intended for you, please contact IT, referencing email ID `{{ $('Get message details in Sublime Security').item.json[\"id\"] }}`.\n\nThe email may be restored by IT if it is determined to be safe.\n\nThank you for helping keep the company secure!", "user": {"__rl": true, "mode": "id", "value": "={{ $json.user.id }}"}, "select": "user", "otherOptions": {}}, "credentials": {"slackApi": {"id": "{{ $credentials.slackApi.id }}", "name": "n8n License Token"}}, "typeVersion": 2.1, "notes": "This slack node performs automated tasks as part of the workflow."}, {"id": "04712fdf-0409-4f9d-bd0b-7e40af9ffade", "name": "Not Found, Do Nothing", "type": "n8n-nodes-base.noOp", "position": [1700, 560], "parameters": {}, "typeVersion": 1, "notes": "This noOp node performs automated tasks as part of the workflow."}, {"id": "c9f8ede6-1886-4779-a4e8-3c32e12d6aae", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [1220, 710.6363009271314], "parameters": {"width": 718.1630306649816, "height": 516.9144812801944, "content": "![Jira]({{ $env.WEBHOOK_URL }}\n## If user opened email before quarantine, create jira ticket\nIf an email is opened prior to quarantine, n8n automatically creates a Jira ticket for further investigation. This ensures a swift response to potential threats that bypass the initial quarantine measures, highlighting n8n's critical role in incident response workflows."}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "a75d35a2-eefa-490c-9a05-9474a1e093fb", "name": "No, do nothing", "type": "n8n-nodes-base.noOp", "position": [1500, 1080], "parameters": {}, "typeVersion": 1, "notes": "This noOp node performs automated tasks as part of the workflow."}, {"id": "8c44c4fb-ec26-4005-b17b-ac8a9ef79721", "name": "Yes, prep flaggedRules table", "type": "n8n-nodes-base.code", "position": [1500, 900], "parameters": {"mode": "runOnceForEachItem", "jsCode": "console.log($(\"Receive Sublime Security Alert\").item.json.body);\n\nconst table = $(\"Receive Sublime Security Alert\")\n  .item.json.body.data.flagged_rules.map(\n    (rule) => `|${rule.name}|${rule.severity}|${rule.tags.join(\",\")}|${rule.id}`\n  )\n  .join(\"\\n\");\n\nconsole.log(table);\n\nreturn {\n  table\n}\n"}, "typeVersion": 2, "notes": "This code node performs automated tasks as part of the workflow."}], "active": false, "pinData": {"Receive Sublime Security Alert": [{"json": {"body": {"data": {"messageId": "d61efe63-b350-4436-bccf-936a7e54503b", "flagged_rules": [{"id": 1, "name": "rule 1", "tags": ["tag-1", "tag-2"], "severity": "high"}, {"id": 2, "name": "rule 2", "tags": ["tag-2", "tag-3"], "severity": "low"}]}}, "query": {}, "params": {}, "headers": {}}}], "Get message details in Sublime Security": [{"json": {"id": "d61efe63-b350-4436-bccf-936a7e54503b", "sender": {"email": "a.sender@gmail.com", "display_name": "A. Sender"}, "mailbox": {"id": "3e51603f-c2cb-4807-bc34-022994b0d149", "email": "john.doe@example.io", "external_id": null}, "read_at": "2023-09-06T11:49:20.355807Z", "subject": "test subject", "created_at": "2023-09-06T11:49:20.355807Z", "recipients": [{"email": "john.doe@example.io"}], "replied_at": null, "external_id": "3", "canonical_id": "1173a16af634b58191cd11291aac39e06dfa418a0140522b4875385c544da511", "forwarded_at": null, "message_source_id": "0ba6712e-6d92-4df8-b6f3-198dcfac08d5", "forward_recipients": []}}]}, "settings": {"executionOrder": "v1", "saveManualExecutions": true, "callerPolicy": "workflowsFromSameOwner", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3, "retryDelay": 1000}, "versionId": "cfa69dd2-286b-46ae-bc6b-6b4086bc8a20", "connections": {"7acb2409-6b67-4500-993f-5beeaecec718": {"main": [[{"node": "error-handler-7acb2409-6b67-4500-993f-5beeaecec718", "type": "main", "index": 0}], [{"node": "error-handler-7acb2409-6b67-4500-993f-5beeaecec718-8cdc6824", "type": "main", "index": 0}], [{"node": "error-handler-7acb2409-6b67-4500-993f-5beeaecec718-374df91b", "type": "main", "index": 0}], [{"node": "error-handler-7acb2409-6b67-4500-993f-5beeaecec718-5121cb40", "type": "main", "index": 0}], [{"node": "error-handler-7acb2409-6b67-4500-993f-5beeaecec718-5b9552de", "type": "main", "index": 0}], [{"node": "error-handler-7acb2409-6b67-4500-993f-5beeaecec718-054035c8", "type": "main", "index": 0}], [{"node": "error-handler-7acb2409-6b67-4500-993f-5beeaecec718-445c3459", "type": "main", "index": 0}], [{"node": "error-handler-7acb2409-6b67-4500-993f-5beeaecec718-20ab2f68", "type": "main", "index": 0}], [{"node": "error-handler-7acb2409-6b67-4500-993f-5beeaecec718-a67c4b06", "type": "main", "index": 0}]]}, "ad876000-e3a4-4f3e-b917-629cc450a15c": {"main": [[{"node": "error-handler-ad876000-e3a4-4f3e-b917-629cc450a15c", "type": "main", "index": 0}], [{"node": "error-handler-ad876000-e3a4-4f3e-b917-629cc450a15c-060a3a11", "type": "main", "index": 0}], [{"node": "error-handler-ad876000-e3a4-4f3e-b917-629cc450a15c-2692c90c", "type": "main", "index": 0}], [{"node": "error-handler-ad876000-e3a4-4f3e-b917-629cc450a15c-871cd62c", "type": "main", "index": 0}], [{"node": "error-handler-ad876000-e3a4-4f3e-b917-629cc450a15c-e709cf29", "type": "main", "index": 0}], [{"node": "error-handler-ad876000-e3a4-4f3e-b917-629cc450a15c-7da69ada", "type": "main", "index": 0}], [{"node": "error-handler-ad876000-e3a4-4f3e-b917-629cc450a15c-9244a89e", "type": "main", "index": 0}], [{"node": "error-handler-ad876000-e3a4-4f3e-b917-629cc450a15c-5e96a96f", "type": "main", "index": 0}], [{"node": "error-handler-ad876000-e3a4-4f3e-b917-629cc450a15c-85629388", "type": "main", "index": 0}]]}, "9c55d492-0fdd-4edd-995c-b3c5fecd9840": {"main": [[{"node": "error-handler-9c55d492-0fdd-4edd-995c-b3c5fecd9840", "type": "main", "index": 0}], [{"node": "error-handler-9c55d492-0fdd-4edd-995c-b3c5fecd9840-6346cfa3", "type": "main", "index": 0}], [{"node": "error-handler-9c55d492-0fdd-4edd-995c-b3c5fecd9840-7986be5f", "type": "main", "index": 0}], [{"node": "error-handler-9c55d492-0fdd-4edd-995c-b3c5fecd9840-d784f282", "type": "main", "index": 0}], [{"node": "error-handler-9c55d492-0fdd-4edd-995c-b3c5fecd9840-14ed982d", "type": "main", "index": 0}], [{"node": "error-handler-9c55d492-0fdd-4edd-995c-b3c5fecd9840-1e833ff4", "type": "main", "index": 0}], [{"node": "error-handler-9c55d492-0fdd-4edd-995c-b3c5fecd9840-18ebb1fb", "type": "main", "index": 0}], [{"node": "error-handler-9c55d492-0fdd-4edd-995c-b3c5fecd9840-c515d2d8", "type": "main", "index": 0}], [{"node": "error-handler-9c55d492-0fdd-4edd-995c-b3c5fecd9840-1d3bd3b3", "type": "main", "index": 0}]]}, "c149a4b8-4f12-4018-a1dc-dfbed9e081eb": {"main": [[{"node": "error-handler-c149a4b8-4f12-4018-a1dc-dfbed9e081eb-5335022b", "type": "main", "index": 0}]]}}, "description": "Automated workflow: Notify_user_in_Slack_of_quarantined_email_and_create_Jira_ticket_if_opened. This workflow integrates 9 different services: webhook, stickyNote, httpRequest, code, noOp. It contains 20 nodes and follows best practices for error handling and security.", "notes": "Excellent quality workflow: Notify_user_in_Slack_of_quarantined_email_and_create_Jira_ticket_if_opened. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}