Templates / Scan incoming Gmail attachments for threats with VirusTotal and GPT-4o-mini

Scan incoming Gmail attachments for threats with VirusTotal and GPT-4o-mini

Ready for 3.0

by Ayaka Sato ✓ · 145 views · created 2026-04-22 · SecOps, AI Summarization

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-12-01.

📬 Weekly n8n 3.0 breakage alerts, free

What this workflow does

This AI workflow has 13 nodes and runs on Gmail events. Along the way it connects Gmail, OpenAI, Slack and Google Sheets and 1 more.

How it runs

Trigger: On Gmail events.

  1. Set Configuration (Edit Fields (Set)): sets 5 fields: review_sheet_id, review_sheet_name, security_slack_channel…
  2. Extract Attachments from Email (Code): runs custom JavaScript code
  3. Compute SHA256 Hash of Attachment (Code): runs custom JavaScript code
  4. Wait: waits 15 seconds
  5. Look Up Hash in VirusTotal (HTTP Request): calls an HTTP API
  6. Classify Phishing Risk with OpenAI (OpenAI): uses OpenAI
  7. Calculate Combined Risk Level (Code): runs custom JavaScript code
  8. Route by Threat Level (Switch): routes items into 3 branches
  9. Apply Quarantine Label on Gmail (Gmail): add labels
  10. Log to Review Queue on Google Sheets (Google Sheets): append

…plus 2 more steps. See the full node list below.

Services it uses

GmailOpenAISlackGoogle SheetsGoogle Drive

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

  • Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (Poll Gmail for New Attachments).
Check at runtime on n8n 3.0
  • Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Informational: a static scan can't see the data, so test these on your own instance. Status above is unchanged.

Nodes used (11)

From the author

Who's it for Small teams, solo operators, and security-conscious individuals who receive email attachments from external senders. Useful for freelancers, agencies, HR teams, and anyone handling CVs, invoices, or documents from unknown sources. How it works…

Excerpt from Ayaka Sato's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.