Quick overview
This workflow monitors a shared support inbox over IMAP and turns new emails into tickets in Notion, creating or reusing a requester record in a Contacts database, uploading attachments to Notion, and adding same-thread replies as comments on the original ticket.
How it works
- Triggers when a new email arrives in the configured IMAP inbox.
- Cleans and normalizes the email subject, body, sender details, and extracts thread headers to support deduplication and follow-up detection.
- Queries the Notion Tickets database to skip emails whose Message-ID is already stored on an existing ticket.
- If the email is a reply, searches Notion for a ticket matching the email’s In-Reply-To/References and prepares to add the message as a comment on that ticket.
- Uploads any email attachments to Notion using the File Upload API, keeping successful uploads and recording failures.
- For follow-ups, posts one or more Notion comments (including uploaded attachments) and appends the new Message-ID to the ticket’s stored Message-IDs.
- For new requests, finds or creates the requester in the Notion Contacts database, creates a ticket (using the database default template when available), inserts the cleaned email content at the top, and then stores the Message-ID on the ticket.
Setup
- Create a Notion integration, share your Tickets and Contacts databases with it, and grant it permission to create pages, upload files, and insert comments.
- Add a Notion API credential in n8n and select it for all Notion HTTP requests.
- Add an IMAP credential for your support mailbox (for Gmail, use an app password) and select it in the IMAP email trigger.
- Replace PASTE_TICKETS_DATABASE_ID and PASTE_CONTACTS_DATABASE_ID in the Settings step with your Notion database IDs.
- Ensure your Tickets database includes properties named Title, Requester (relation), Message-IDs (rich text), and Attachments (files), and your Contacts database includes Email and Name (plus optional First name/Last name) to match the workflow queries.
Requirements