Build an AI Email Triage Assistant

Automate email classification and routing using Groq's LLM API and n8n.

Introduction

30 Second Summary

Your inbox is a firehose. Important emails get buried under newsletters, spam, and FYI threads. By the time you spot something urgent, it's already too late.

In this project, you will build an AI-powered email triage assistant that watches your Gmail around the clock, classifies every incoming email by urgency, and routes it to the right place automatically.

What You'll Build

You'll have a live automation that you can show someone in real time: send yourself an email, and within seconds watch a Telegram alert pop up on your phone or a Trello card appear on your board.

By the end of this project, you'll have:

  • A Telegram alert that pings your phone within seconds of an urgent email landing in your inbox.
  • Automatic Trello cards created from action-item emails, complete with AI-generated summaries so you never forget a task.
  • A production-grade error handling workflow that alerts you on Telegram when anything breaks, instead of failing silently.
  • Secret Mission: a scheduled daily digest that summarizes all emails processed in the last 24 hours and sends it to Telegram each morning.

Are there any prerequisites?

This project assumes basic n8n experience (creating workflows, connecting nodes). You'll also need a Gmail account, a Telegram account, and a Trello account.

Before We Start

Before we dive in, let's lock in what you're about to build and why it matters for your automation skills.

Set Up Credentials

Your workflow connects to four external services: Groq for AI classification, Gmail for reading emails, Telegram for instant alerts, and Trello for task cards.

Before the workflow can talk to any of these services, it needs credentials. In this step, you will create an API key for Groq and authorize Gmail, Telegram, and Trello inside n8n.

In this step, get ready to:
  • Create a Groq API key and save it as a credential in n8n.
  • Authorize Gmail and Trello via OAuth in n8n.
  • Create a Telegram bot and obtain your personal chat ID.
Create your Groq API key

Groq provides free access to powerful LLMs. You need an API key so n8n can call Groq's classification endpoint on your behalf.

  • Open your browser and go to console.groq.com.
  • Sign up for a free account (no credit card required).
  • Once signed in, click API Keys in the left sidebar.
  • Click Create API Key.
  • Enter n8n integration as the display name.
  • Click Submit.
  • Copy the API key immediately. You will not be able to see it again after closing this dialog.

Why copy it now?

Groq only displays the full API key once, at the moment of creation. If you close the dialog without copying it, you will need to delete the key and create a new one.

Now save this key as a credential in n8n.

  • Switch back to your n8n Cloud tab in the browser.
  • In the left sidebar, click Credentials.
  • Click Add Credential.
  • Search for Groq and select it from the list.
  • Paste your API key into the API Key field.
  • Click Save.

n8n automatically tests the credential when you save. You should see a green checkmark confirming the connection succeeded.

Not seeing a green checkmark?

  • Make sure you pasted the full key with no leading or trailing spaces.
  • If you accidentally closed the Groq creation dialog before copying, go back to the API Keys page, delete the old key, and create a new one.
  • help me fix my Groq credential connection in n8n
Authorize Gmail and Trello

Gmail and Trello both use OAuth2 to grant n8n permission to act on your behalf. This means you sign in with your existing account and approve access, rather than copying a key.

  • In n8n, click Credentials in the left sidebar.
  • Click Add Credential.
  • Search for Gmail and select it.
  • Click Sign in with Google.
  • In the popup, select your Gmail account and approve all requested permissions.
  • Click Save. You should see a green checkmark.

Now repeat for Trello.

  • Click Add Credential again.
  • Search for Trello and select it.
  • Authorize via OAuth by signing into your Trello account in the popup and approving access.
  • Click Save. Confirm you see a green checkmark.

OAuth popup not appearing?

  • Check that your browser is not blocking popups for the n8n Cloud domain.
  • Try disabling any ad-blocker extensions temporarily.
  • help me fix the OAuth popup for Gmail or Trello in n8n
Create a Telegram bot and get your chat ID

Telegram bots are how n8n sends you messages. You will create a bot, grab its token, then find your personal chat ID so n8n knows where to send alerts.

  • Open Telegram on your phone or desktop.
  • Search for @BotFather and open a chat with it.
  • Send the message /newbot.
  • When prompted for a name, type Email Triage Bot.
  • When prompted for a username, pick something unique ending in bot (for example, emailtriage_yourname_bot).
  • BotFather will reply with a bot token. Copy this token.

Now save the bot token in n8n.

  • Switch back to n8n.
  • Click Credentials in the left sidebar, then Add Credential.
  • Search for Telegram and select it.
  • Paste your bot token into the Access Token field.
  • Click Save. Confirm the green checkmark appears.

What is a chat ID?

Telegram bots cannot message anyone unless they know the recipient's numeric chat ID. You need to "introduce" yourself to the bot first by sending it any message. Then you query an API endpoint to retrieve your ID.

  • Go back to Telegram and open a chat with your new bot (search for it by the username you chose).
  • Send it any message, such as hello.
  • Open your browser and visit the following URL, replacing YOUR_BOT_TOKEN_HERE with the actual bot token you just copied:
https://api.telegram.org/botYOUR_BOT_TOKEN_HERE/getUpdates
  • In the JSON response, look for the "chat":{"id": field. The number after it is your personal chat ID.
  • Write down or copy this chat ID. You will need it in a later step when configuring the Telegram node.

Keep your chat ID handy

Save your chat ID somewhere accessible (a sticky note, text file, or your clipboard). You will paste it into the Telegram node in Step 4.

Seeing an empty result array?

  • Make sure you sent a message to your bot before visiting the URL. The bot only reports messages it received after creation.
  • Double check you replaced the placeholder in the URL with your actual bot token, including the numbers before the colon.
  • help me find my Telegram chat ID from the getUpdates response

You now have all four credentials configured. Take a look at your n8n Credentials page. You should see four entries, each with a green checkmark confirming a successful connection test.

Your credentials are locked and loaded. Next up, you will build the workflow that triggers on new emails and sends them to Groq for AI classification.

Build the Gmail Trigger and AI Classification

Your credentials are all connected and tested. Now it's time to build the actual automation that watches your inbox and classifies every incoming email.

The core of any automation is a trigger paired with an action. In this step, you'll create a workflow where incoming emails trigger an LLM classification call to Groq, giving you real-time insight into what needs your attention.

In this step, get ready to:
  • Create the Email Triage Assistant workflow with a Gmail Trigger.
  • Configure an HTTP Request node to classify emails using Groq's LLM API.
  • Test the workflow with a real email and see the AI's classification.
Create the workflow and add the Gmail Trigger

Every n8n workflow starts with a trigger node that fires when something happens. For email triage, that trigger is a new email landing in your inbox.

  • In n8n Cloud, click the + Create Workflow button on the dashboard.
  • Name the workflow Email Triage Assistant by clicking the default name at the top of the canvas and typing the new name.
  • Click the + button in the centre of the canvas to add your first node.
  • Search for Gmail Trigger in the node search panel.
  • Select Gmail Trigger from the results.
  • Under Credential to connect with, select your Gmail credential from Step 1.
  • Leave the Event set to Message Received (the default).
  • Under Filters, open Label Names or IDs and select INBOX from the dropdown.

You should now see the Gmail Trigger node on your canvas with your credential connected.

What is a trigger node?

A trigger node is the starting point of any n8n workflow. It listens for an event (in this case, a new email) and passes that event's data to the next node in the chain.

The Gmail Trigger polls your inbox at regular intervals. When it finds a new message, it outputs the email's subject, body, sender, and other metadata for downstream nodes to use.

Add the HTTP Request node for AI classification

With the trigger in place, you need a node that sends the email content to Groq's API for classification. The HTTP Request node lets you call any REST API directly from your workflow.

  • Click the + connector on the right side of your Gmail Trigger node to add a new node after it.
  • Search for HTTP Request and select it.
  • Set Method to POST.
  • Set URL to:
https://api.groq.com/openai/v1/chat/completions
  • Under Authentication, select Predefined Credential Type.
  • In the Credential Type dropdown that appears, search for and select Groq API.
  • Select your n8n integration credential from the credential dropdown.

Now configure the request body that tells the LLM what to do with each email.

  • Toggle Send Body to on.
  • Set Body Content Type to JSON.
  • Set Specify Body to Using JSON.
  • Paste the following JSON into the body editor:
{
  "model": "llama-3.3-70b-versatile",
  "temperature": 0.1,
  "messages": [
    {
      "role": "system",
      "content": "You are an email classifier. Respond with ONLY a JSON object with these fields: category (urgent, action_needed, fyi, spam), urgency (high, medium, low), summary (one sentence), action_needed (what to do, or null)."
    },
    {
      "role": "user",
      "content": "Subject: {{ $json.subject }}\n\nBody: {{ $json.text }}"
    }
  ]
}

What does this JSON body do?

This is the request payload sent to Groq's OpenAI-compatible API. It tells the llama-3.3-70b-versatile model exactly how to respond.

  • The system message constrains the model to output only a structured JSON object with four specific fields.
  • The user message injects the actual email content using n8n expressions. {{ $json.subject }} pulls the email subject and {{ $json.text }} pulls the email body from the Gmail Trigger output.
  • Setting temperature to 0.1 makes the output highly deterministic. Classification needs consistency, not creativity.

Your canvas should now show two nodes connected in sequence: Gmail Trigger flowing into HTTP Request.

Don't see the Groq API credential option?

Make sure you select Predefined Credential Type first (not "Generic Credential Type" or "None"). The Groq API option only appears after you choose the predefined route.

If Groq API still doesn't appear in the search, confirm your n8n Cloud instance is up to date. Help me troubleshoot my Groq API credential in n8n

Test the workflow with a real email

The workflow is wired up, but you haven't seen it run yet. Time to send a test email and watch the AI classify it in real time.

  • Open a new browser tab and send yourself an email with the subject: URGENT: Server is down.
  • Add a short body like: "The production server stopped responding 5 minutes ago. Please investigate immediately."
  • Switch back to your n8n workflow tab.
  • Click Test workflow in the top-right corner of the canvas.

Before you look at the output, think about this: based on the system prompt you configured, what category and urgency do you expect the AI to assign to your "Server is down" email?

  • Once the execution completes (both nodes turn green), click on the HTTP Request node to open its output panel.
  • Expand the response body. You should see Groq's JSON classification nested inside data.choices[0].message.content.

The response content should contain a JSON object with category set to urgent, urgency set to high, and a one-sentence summary of your email.

Why is the classification nested so deeply?

Groq's API wraps the model's actual text output inside a standard OpenAI-compatible response structure. The path data.choices[0].message.content is where every OpenAI-compatible API puts the generated text.

In the next step, you'll add a Code node that extracts just the classification JSON from this nested response and makes it easy for downstream nodes to use.

Execution failed or no output?

  • If the Gmail Trigger shows no data, check that your test email has arrived in your inbox (not spam) and try clicking Test workflow again.
  • If the HTTP Request node shows a 401 error, re-open your Groq credential in n8n and verify the API key is correct.
  • If you see a 429 error, you've hit Groq's rate limit (30 requests per minute on the free tier). Wait 60 seconds and try again.

Help me debug my email triage workflow test

Your workflow can now watch your inbox and ask an AI to classify every new email. Next up, you'll parse that nested response into clean data and route it to different actions based on the classification.

Parse and Route the Classification

Your workflow can now call Groq and receive a classification back. The next challenge is turning that raw API response into something your workflow can route on.

Groq's response nests the classification deep inside a JSON response object. It also sometimes wraps the output in markdown code fences, even when instructed not to. A Switch node wired directly to this raw response would silently fail to match any route. You need a parsing layer that strips away the wrapping and hands clean data to the router.

In this step, get ready to:
  • Add a Code node that parses and cleans Groq's response.
  • Add a Switch node that routes emails by category.
  • Test that different email types route to the correct branches.
Add a Code node to parse the Groq response

The Code node runs custom JavaScript inside your workflow. You will use it to dig into Groq's nested response, strip any markdown code fences, and output a clean object with four fields: category, urgency, summary, and action_needed.

  • Click the + button to the right of your HTTP Request node.
  • Search for Code and select it.
  • Make sure Language is set to JavaScript and Mode is set to Run Once for All Items.
  • Delete any placeholder code in the editor, then paste the following:
// Parse the Groq API response and extract classification JSON
const response = $input.first().json;
const content = response.data.choices[0].message.content;

// Handle markdown code fence wrapping (Groq sometimes wraps JSON in ```json ... ```)
let parsed;
try {
  const cleaned = content.replace(/```json\n?/g, '').replace(/```\n?/g, '').trim();
  parsed = JSON.parse(cleaned);
} catch (e) {
  // Fallback: if parsing fails, create a safe default
  parsed = {
    category: 'unknown',
    urgency: 'low',
    summary: content.substring(0, 200),
    action_needed: 'Review manually - AI classification failed'
  };
}

return [{ json: parsed }];

What does this code do?

  • $input.first().json grabs the first item from the previous node (the Groq HTTP response).
  • response.data.choices[0].message.content drills into the nested API structure to get the actual text Groq generated.
  • The replace() calls strip markdown code fences that Groq sometimes adds around JSON output.
  • The catch block provides a safe fallback object if parsing fails, so the workflow never crashes on bad LLM output.

✔️ Awesome, I've got everything!

Great. Double check you have the code pasted in the Code node editor and move on.

ⓧ I'd like to double check the full code

Here is the full Code node content. Make sure yours matches exactly:

// Parse the Groq API response and extract classification JSON
const response = $input.first().json;
const content = response.data.choices[0].message.content;

// Handle markdown code fence wrapping (Groq sometimes wraps JSON in ```json ... ```)
let parsed;
try {
  const cleaned = content.replace(/```json\n?/g, '').replace(/```\n?/g, '').trim();
  parsed = JSON.parse(cleaned);
} catch (e) {
  // Fallback: if parsing fails, create a safe default
  parsed = {
    category: 'unknown',
    urgency: 'low',
    summary: content.substring(0, 200),
    action_needed: 'Review manually - AI classification failed'
  };
}

return [{ json: parsed }];
  • Close the Code node panel.
  • Click Test workflow to run it with the test email you sent in the previous step.
  • Click on the Code node in the canvas to inspect its output.

You should see a clean JSON object with category, urgency, summary, and action_needed fields in the output panel. No nested data.choices wrapper, no code fences.

Seeing an error in the Code node?

  • If you see "Cannot read properties of undefined", make sure the HTTP Request node ran successfully first. Click on it and confirm it has output data.
  • If you see a syntax error, check that you pasted the full code without cutting off the closing brackets.
  • If the output shows the fallback object (category unknown), Groq may have returned an unexpected format. That is the fallback working as designed.

Why is my Code node failing?

Configure a Switch node for routing

Now that the Code node outputs a clean classification object, you can route emails to different paths based on their category.

  • Click the + button to the right of the Code node.
  • Search for Switch and select it.
  • In the Switch node settings, make sure Mode is set to Rules.
  • In the first routing rule, set Value 1 to the expression {{ $json.category }}, Operation to Equals, and Value 2 to urgent.
  • Click Add Routing Rule to add a second rule. Set it to match {{ $json.category }} equals action_needed.
  • Add a third rule matching {{ $json.category }} equals fyi.
  • Scroll down to Fallback Output and set it to Extra Output. This catches anything else, including spam and parse failures.
  • Close the Switch node panel.

Why a Fallback output?

LLMs are not perfectly deterministic. Groq might occasionally return a category you did not anticipate, or the Code node's fallback might fire with category: 'unknown'. The Fallback output ensures these items land somewhere safe instead of silently disappearing.

Test routing with different emails

Before you trigger the workflow, think about this: if you send yourself an email with the subject "CRITICAL: Production database is offline", which Switch output do you expect to light up?

  • Send yourself a test email with the subject CRITICAL: Production database is offline.
  • Click Test workflow in n8n and wait for the execution to complete.
  • Click on the Switch node to inspect its output.

The first output (urgent) should light up green, showing the email routed to the urgent branch.

  • Now send yourself a second test email with a newsletter-style subject, like Weekly roundup: top articles this week.
  • Click Test workflow again and inspect the Switch node output.

This time, the third output (fyi) or the Fallback output should light up, depending on how Groq classifies the newsletter.

Switch node not routing correctly?

  • Click the Code node and check its output. If you see the raw Groq response (with data.choices nesting) instead of a flat object, the Code node did not run. Delete it and re-add it, making sure it connects between the HTTP Request and Switch.
  • If all items hit the Fallback, check that Value 1 in each routing rule uses the expression {{ $json.category }} (not a fixed string).
  • If you see category: 'unknown' in the Code node output, Groq returned something unparseable. Try running the test again. LLM responses are not always identical.

Why is my Switch node sending everything to Fallback?

Your workflow now classifies emails and routes them to the right branch. Next up, you will wire those branches to real actions: Telegram alerts for urgent emails and Trello cards for action items.

Connect Telegram Alerts and Trello Cards

Your workflow classifies every email and routes it down the right Switch branch. The branches light up green in the execution view, but nothing actually happens at the other end.

Classification without action is just logging. In this step, you'll wire Telegram to the urgent branch for instant mobile alerts. You'll also connect Trello to the action_needed branch so tasks get created automatically.

In this step, get ready to:
  • Wire a Telegram node to send alerts for urgent emails.
  • Wire a Trello node to create cards for action items.
  • Test the full flow end-to-end with real emails.
Add a Telegram node to the urgent branch

When the Switch node routes an email as "urgent", you want an instant notification on your phone. You'll connect a Telegram Send Message node to that output.

  • In your workflow canvas, click the + connector on the Switch node's first output (the "urgent" route).
  • Search for Telegram and select the Telegram node.
  • Set Resource to Message.
  • Set Operation to Send Message.
  • In the Credential to connect with dropdown, select the Telegram credential you created in Step 1.
  • In the Chat ID field, enter your personal chat ID (the number you found using the getUpdates endpoint in Step 1).
  • In the Text field, click the field to open it, then toggle the Expression tab. Paste the following message template:
URGENT EMAIL

Summary: {{ $('Code').item.json.summary }}
From: {{ $('Gmail Trigger').item.json.from }}
Action: {{ $('Code').item.json.action_needed }}

What do these expressions do?

  • `{{ $('Code').item.json.summary }}` pulls the one-sentence summary that the AI generated in the Code node.
  • `{{ $('Gmail Trigger').item.json.from }}` grabs the sender's email address from the original Gmail Trigger data.
  • `{{ $('Code').item.json.action_needed }}` includes the AI's recommended next action so you know what to do immediately.
  • Under Additional Fields, click Add Field and turn off Append n8n Attribution so your alerts stay clean.
  • Close the Telegram node panel.
Add a Trello node to the action_needed branch

Emails classified as "action_needed" represent tasks you should track. You'll auto-create a Trello card for each one.

  • Click the + connector on the Switch node's second output (the "action_needed" route).
  • Search for Trello and select the Trello node.
  • Set Resource to Card.
  • Set Operation to Create.
  • In the Credential to connect with dropdown, select the Trello credential you created in Step 1.
  • Select your target Board from the dropdown (any board you use for tasks).
  • Select a List where new cards should land (e.g., "Inbox" or "To Do").
  • In the Name field, toggle to Expression and enter:
{{ $('Gmail Trigger').item.json.subject }}
  • In the Description field, toggle to Expression and paste:
{{ $('Code').item.json.summary }}

From: {{ $('Gmail Trigger').item.json.from }}

What does this Trello configuration do?

Each time an email classified as "action_needed" flows through, the Trello node creates a new card. The card title is the email's subject line, and the description includes the AI's summary plus the sender's address. This means your task board populates itself automatically.

  • Close the Trello node panel.
Test the full flow end-to-end

Both branches are wired. Time to prove they actually deliver results to your phone and your task board.

  • Send yourself a test email with the subject line CRITICAL: Production database is offline (this should trigger the urgent path).
  • Send yourself a second test email with the subject line Please review the Q3 budget proposal (this should trigger the action_needed path).
  • Back in n8n, click Test workflow and wait for the execution to complete.

Before you check the results, predict: which branches should light up green for each email? Do you expect to see a Telegram message for the first email and a Trello card for the second?

  • Check your Telegram app. You should see an alert message containing the AI summary, the sender address, and the recommended action.
  • Open your Trello board. You should see a new card in your target list with the email's subject as the card title and the AI summary in the description.

No Telegram message or Trello card?

  • Click on the Switch node output panel and confirm the email routed to the correct branch. If it went to "fyi" or "fallback", the AI may not have classified your test email as urgent or action-needed. Try a more explicit subject like "URGENT: Server is down".
  • If the Telegram node shows a red error, double-check that your Chat ID is a numeric value (not a username). Revisit the getUpdates URL from Step 1 to re-confirm it.
  • If the Trello node errors with "invalid list", make sure you selected both a Board and a List in the node settings. The List dropdown only populates after a Board is chosen.
  • If expression fields show an error about missing data, make sure you ran the full workflow (not just a single node) so data flows from the Gmail Trigger through to the end.

Still stuck? Help me debug why my Telegram or Trello node isn't working in n8n

Classification now triggers real actions. Urgent emails ping your phone within seconds. Action items land on your Trello board automatically. Next up, you'll make sure this workflow never fails silently by adding error handling.

Add Error Handling

Your email triage workflow classifies and routes emails correctly. But what happens when Groq hits its free-tier rate limit of 30 requests per minute, or returns an unexpected response?

Right now, the workflow fails silently. You would never know it stopped working. A production automation needs to tell you when it breaks. In this step, you will create a dedicated Error Handler workflow that sends you a Telegram alert whenever the main workflow encounters an error.

In this step, get ready to:
  • Create an Error Handler workflow that alerts you on Telegram when something breaks.
  • Configure the main workflow with retry logic and an error workflow link.
  • Test error handling by intentionally breaking the API key and confirming the alert arrives.
Create the Error Handler workflow

The Error Handler is a separate workflow whose only job is to listen for failures in other workflows and notify you immediately.

  • In n8n, click the n8n logo (top left) to return to the workflows list.
  • Click Add workflow to create a new workflow.
  • Name the workflow Error Handler by clicking the workflow name at the top.

Now add the Error Trigger node as the first node in this workflow.

  • Click Add first step on the canvas.
  • Search for Error Trigger and select it.

What is an Error Trigger?

The Error Trigger node starts a workflow when another linked workflow fails. It receives data about the failure including the workflow name, the node that errored, and the error message.

You configure which workflows use this error workflow in their individual settings. One Error Handler can serve multiple workflows.

Next, add a Telegram node to send yourself the error details.

  • Click the + connector coming out of the Error Trigger node.
  • Search for Telegram and select it.
  • Set Operation to Send Message.
  • Select your Telegram credential (the one you created in Step 1).
  • In Chat ID, enter your personal chat ID (the same one you used for urgent alerts).
  • In the Text field, compose your error alert message using the following expressions:
⚠️ WORKFLOW ERROR

Workflow: {{ $json.workflow.name }}
Failed Node: {{ $json.execution.error.node.name }}
Error: {{ $json.execution.error.message }}

What do these expressions do?

  • `{{ $json.workflow.name }}` pulls the name of the workflow that failed.
  • `{{ $json.execution.error.node.name }}` shows which specific node caused the error.
  • `{{ $json.execution.error.message }}` includes the actual error message so you can diagnose the problem from the alert alone.
  • Click Save in the top right corner.
  • Toggle the Active switch in the top right to activate this workflow.

Your Error Handler workflow is now live and waiting for errors from linked workflows.

Don't see the Active toggle?

Make sure you have saved the workflow first. The Active toggle only appears after saving. Also confirm the Error Trigger node is connected to the Telegram node with no validation errors showing on either node.

Help me troubleshoot my Error Handler workflow

Link the error workflow and add retry logic

Now you need to tell your main workflow to use the Error Handler when something goes wrong. You will also add automatic retry logic to the Groq API call so transient rate-limit errors (HTTP 429 responses) resolve themselves without triggering a full alert.

  • Switch back to the Email Triage Assistant workflow from the workflows list.
  • Click the gear icon (Settings) in the top menu bar to open Workflow Settings.
  • In the Error workflow dropdown, select Error Handler.
  • Click Save to apply the setting.

Any unhandled error in this workflow will now trigger your Error Handler and send you a Telegram alert.

Next, configure the HTTP Request node to retry automatically before escalating.

  • Double-click the HTTP Request node (the Groq API call) to open it.
  • Click the Settings tab at the top of the node panel.
  • Enable the Retry On Fail toggle.
  • Set Max Tries to 3.
  • Set Wait Between Tries (ms) to 5000.
  • Close the node panel and click Save.

Why 3 retries at 5000ms?

Groq's free tier allows 30 requests per minute. If your workflow hits a rate-limit error (HTTP 429), the node will wait 5 seconds and try again. Three attempts with 5-second gaps give the rate limit time to reset without sending you a false-alarm error alert.

Only if all 3 retries fail does the workflow error out and trigger your Error Handler.

Test the error handling and activate

The error workflow only fires during automatic (production) executions, not manual test runs. To test it properly, you need to activate the main workflow, cause it to fail, and confirm the alert arrives on Telegram.

  • In the Email Triage Assistant workflow, toggle the Active switch to activate it.
  • Navigate to Credentials in the left sidebar.
  • Open your Groq API credential.
  • Change the API key value to something invalid (e.g., replace the last few characters with xxxxx).
  • Click Save on the credential.

Now trigger the workflow by sending yourself a test email (any subject and body will do).

Before you check Telegram, think about what you expect to happen. The Gmail Trigger picks up the email. The HTTP Request node calls Groq with an invalid key. All 3 retry attempts fail. Then what should your Error Handler do?

  • Check your Telegram chat with the bot.

You should see an error alert message containing the workflow name, the node that failed (HTTP Request), and the error message from Groq about an invalid API key.

No Telegram alert after a few minutes?

Remember that error workflows only fire on production (automatic) executions, not manual test runs. Confirm that both workflows show as Active (green toggle). Also check the Executions tab on your Email Triage Assistant workflow to see if the execution appeared and failed.

Help me debug my missing error alert

Now restore your credentials and confirm everything works normally again.

  • Go back to Credentials and open your Groq API credential.
  • Restore the correct API key value.
  • Click Save on the credential.
  • Send yourself another test email to confirm the full workflow runs successfully again.
  • Check the Executions tab on the Email Triage Assistant workflow. You should see a successful execution (green checkmark) for the latest email.

Your Email Triage Assistant is now live and running continuously. Emails will be classified and routed in real time, and you will be alerted instantly if anything breaks.

Your automation is production-grade. It classifies, routes, retries, and alerts. Next up, you have a Secret Mission waiting for you.

Secret mission

Add a Daily Email Digest

Your triage system handles individual emails in real time. But what about the big picture? In this secret mission, you'll build a scheduled workflow that fires every morning, fetches the last 24 hours of email, asks Groq to summarize the batch, and sends you a formatted digest on Telegram.

Clean Up Your Resources

Clean Up Your Resources

Decide whether to keep your resources running, pause them to come back later, or delete them entirely. This project runs entirely on free tiers with no credit card required, though active workflows consume executions from your n8n Cloud free plan quota.

Resources you used:

  • n8n workflow "Email Triage Assistant" (active, consuming executions).
  • n8n workflow "Error Handler" (active, fires only on errors).
  • n8n workflow "Daily Email Digest" (active, fires daily at 8:00 AM).
  • Groq API key (free tier, no charges).
  • Telegram bot (free, no cost).
  • n8n credentials (Groq, Gmail, Telegram, Trello).

Keep everything running

No action needed. Choose this if you're still actively building or want the triage assistant running in the background.

  • All three workflows stay active and process emails as they arrive.
  • Monitor your n8n Cloud execution quota in your account settings to ensure you stay within the free plan limits.
  • Your Telegram bot, Groq API key, and OAuth connections remain active at no cost.

Pause - I'll come back to this later

Shut down running workflows to stop consuming executions. Your workflows and credentials stay saved for when you return.

  • In n8n, open the "Email Triage Assistant" workflow and click the toggle in the top-right corner to deactivate it.
  • Do the same for the "Error Handler" workflow.
  • Do the same for the "Daily Email Digest" workflow.
  • No executions are consumed while workflows are inactive. Reactivate anytime by toggling them back on.

Delete - I don't want to use this again

Remove all project resources and start fresh. Follow each step below to fully clean up.

  • In n8n, open the "Email Triage Assistant" workflow, click the three-dot menu in the top-right corner, and select Delete.
  • Repeat for the "Error Handler" workflow and the "Daily Email Digest" workflow.
  • In n8n, go to Credentials in the left sidebar. Click the Groq credential, then click Delete. Repeat for the Telegram credential.
  • To delete your Groq API key, go to the Groq console at console.groq.com, navigate to API Keys, and delete the "n8n integration" key.
  • To delete your Telegram bot, open Telegram, message @BotFather, and send /deletebot. Select your Email Triage Bot from the list to confirm deletion.
  • To revoke Gmail access, go to your Google Account's linked apps page. Select Access to your Google Account, find the n8n app, select See details, then click Remove access and confirm.
  • To revoke Trello access, visit https://trello.com/u/my/account. Scroll down to the Applications section, find the n8n entry, and click Revoke.

That's a Wrap!

That's a Wrap!

Nice work! You've just built a production-grade AI email triage system that classifies, routes, and acts on your emails automatically using n8n and Groq.

You've learned how to:

  • Called Groq's Llama 3.3 70B model via direct API requests to classify emails by urgency and category, with structured output parsing that gracefully handles malformed LLM responses.
  • Wired conditional routing to send urgent alerts to Telegram and create Trello cards for action items based on AI classification.
  • Built a production-grade error handling workflow that alerts you on Telegram instead of failing silently.
  • Secret Mission: Added a scheduled daily digest that summarizes your email patterns each morning.

Ready to quiz yourself?