This workflow corresponds to n8n.io template #2515 — we link there as the canonical source.
This workflow follows the Chainllm → HTTP Request recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "NuEN2uwPicogoHom",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Gmail to line",
"tags": [],
"nodes": [
{
"id": "33cb4970-014e-454c-81c4-0511bfae69cd",
"name": "Read emails (IMAP)",
"type": "n8n-nodes-base.emailReadImap",
"position": [
280,
220
],
"parameters": {
"options": {},
"postProcessAction": "nothing"
},
"credentials": {
"imap": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "7180288e-8260-4707-b714-73be852a0755",
"name": "Send summarized content to messenger",
"type": "n8n-nodes-base.httpRequest",
"position": [
1380,
200
],
"parameters": {
"url": "https://api.line.me/v2/bot/message/push",
"method": "POST",
"options": {},
"jsonBody": "={ \n \"to\": \"U3ec262c49811f30cdc2d2f2b0a0df99a\", \n \"messages\": [ \n { \n \"type\": \"text\", \n \"text\": \"{{ $json.output.summary.replace(/\\\\n/g, '\\\\n') }}\"\n } \n ] \n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "d1ca1fc2-f4ff-49da-9c2b-f945e090192d",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
120,
-40
],
"parameters": {
"width": 361,
"height": 90,
"content": "## Summarize emails with A.I.\nYou can find out more about the [use case](https://rumjahn.com/how-a-i-saved-my-kids-school-life-and-my-marriage/)"
},
"typeVersion": 1
},
{
"id": "8cef000e-458a-4408-961b-70bd3e69aa0e",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
120
],
"parameters": {
"color": 5,
"width": 229,
"height": 280,
"content": "Find your email server's IMAP Settings. \n- Link for [gmail](https://www.getmailspring.com/setup/access-gmail-via-imap-smtp)"
},
"typeVersion": 1
},
{
"id": "379fe17a-40ee-4174-8e8e-98d9ce7a7bbb",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
520,
-40
],
"parameters": {
"color": 6,
"width": 365,
"height": 442,
"content": "For the A.I. you can use Openrouter.ai. \n- Set up a free account\n- The A.I. model selected is FREE to use.\n## Credentials\n- Use header auth\n- Username: Authorization\n- Password: Bearer {insert your API key}.\n- The password is \"Bearer\" space plus your API key."
},
"typeVersion": 1
},
{
"id": "d88115fb-89ad-4f8f-9e50-2602c658692e",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1280,
-60
],
"parameters": {
"color": 4,
"width": 307,
"height": 439,
"content": "Don't use the official Line node. It's outdated.\n## Credentials\n- Use header auth\n- Username: Authorization\n- Password: Bearer {channel access token}\n\nYou can find your channel access token at the [Line API console](https://developers.line.biz/console/). Go to Messaging API and scroll to the bottom."
},
"typeVersion": 1
},
{
"id": "d4985708-c87e-4b0a-9e72-c87ca07f261d",
"name": "Basic LLM Chain",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
560,
220
],
"parameters": {
"text": "=Analyze this email and determine if it requires attention. \n \nIMPORTANT EMAILS include: \n- Action items or deadlines \n- Payment due dates \n- Registration deadlines \n- Urgent requests \n- Meeting invitations \n- Important announcements \n \nFor important emails, provide a summary with deadlines and action items. \nFor unimportant emails (newsletters, promotions, automated notifications), set isImportant to false. \n \nEmail content: \nFrom: {{ encodeURIComponent($json.from) }} \nSubject: {{ encodeURIComponent($json.subject) }} \n{{ encodeURIComponent($json.textHtml) }} ",
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.6
},
{
"id": "534d65d9-0d44-4af2-9f69-c7deb46e2556",
"name": "OpenRouter Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
540,
420
],
"parameters": {
"model": "google/gemini-2.5-flash-preview-05-20",
"options": {}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "d133ab53-71da-462d-9a9e-8427967b1dbb",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
720,
420
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{ \n \"type\": \"object\", \n \"properties\": { \n \"isImportant\": { \n \"type\": \"boolean\", \n \"description\": \"Whether this email requires attention\" \n }, \n \"summary\": { \n \"type\": \"string\", \n \"description\": \"Summary of the email if important, empty if not\" \n } \n }, \n \"required\": [\"isImportant\"] \n}"
},
"typeVersion": 1.2
},
{
"id": "4eb2bbd0-7fa1-44b1-abfa-0e424e42c93f",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
1000,
220
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a8dddd45-97b9-4dda-97f1-f5d959095e2b",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.output.isImportant }}",
"rightValue": "true"
}
]
}
},
"typeVersion": 2.2
}
],
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "bb0850f4-2877-4769-a24c-962f3734af69",
"connections": {
"If": {
"main": [
[
{
"node": "Send summarized content to messenger",
"type": "main",
"index": 0
}
]
]
},
"Basic LLM Chain": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Read emails (IMAP)": {
"main": [
[
{
"node": "Basic LLM Chain",
"type": "main",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "Basic LLM Chain",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Basic LLM Chain",
"type": "ai_outputParser",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
httpHeaderAuthimapopenRouterApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Anyone who is drowning in emails Busy parents who has alot of school emails Busy executives with too many emails
Source: https://n8n.io/workflows/2515/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Alrouf AI Integration (Production). Uses googleSheets, chainLlm, lmChatGoogleGemini, outputParserStructured. Manual trigger; 21 nodes.
This n8n template demonstrates how to use AI text classification to automatically categorize incoming emails in Zoho Mail and apply the correct label (e.g., Support, Billing, HR). It saves time by kee
Stickynote Emailreadimap. Uses hubspot, lmChatOpenAi, chainLlm, emailReadImap. Manual trigger; 13 nodes.
Create E-Mail Responses With Fastmail And Openai. Uses httpRequest, splitOut, emailReadImap, openAi. Manual trigger; 11 nodes.
This n8n workflow automates the drafting of email replies for Fastmail using OpenAI's GPT-4 model. Here’s the overall process: Email Monitoring: The workflow continuously monitors a specified IMAP inb