Cron

Günlük Gmail Özeti

01 May 2026

Description

Her gün belirli bir saatte Gmail hesabınızdan gelen son 20 e‑posta mesajını alır, özetler ve size e‑posta ya da Slack üzerinden gönderir.

Setup Guide

1. n8n içinde bir yeni workflow oluşturun.
2. "Cron" düğümünü ekleyin; "Every Day" ve istediğiniz saati (ör. 08:00) seçin.
3. "Gmail" düğümünü ekleyin, "Get All Emails" → "Search" seçin ve `is:unread` ya da `newer_than:1d` filtresini girin. Sonuç sayısını 20 ile sınırlayın.
4. "Set" düğümü ekleyerek e‑posta konu ve gövde alanlarını `{{ $json.body }}` gibi bir değişkende birleştirin (ör. `text = $json.subject + "\n" + $json.body`).
5. "Function" düğümü ekleyin; burada bir dizi oluşturup tüm e‑postaları tek bir metin haline getirin ve `items[0].json.summaryInput` değişkenine atayın.
6. "OpenAI" (ChatGPT) düğümünü ekleyin; Model: `gpt-4o-mini`, Prompt: `Summarize the following email thread in Turkish, max 150 words:\n{{ $json.summaryInput }}`.
7. "IF" düğümü ekleyin; OpenAI yanıtı boş mu kontrol edin. Boşsa workflow sonlandırılır.
8. "EmailSend" düğümünü ekleyin; alıcı adresinizi, konu: "Günlük Gmail Özeti", gövde: `{{ $json.choices[0].message.content }}` olarak ayarlayın.
9. Gmail düğümüne OAuth2 kimlik bilgilerinizi (Gmail API) ekleyin; gerekli kapsamlar: `https://www.googleapis.com/auth/gmail.readonly`.
10. Workflow’u kaydedin ve etkinleştirin. Her gün seçtiğiniz saatte özet otomatik olarak gönderilecektir.

Workflow Preview

Loading Visualization...

JSON Code

automation.json
{
    "nodes": [
        {
            "parameters": {
                "cronExpression": "0 8 * * *",
                "timezone": "Europe\/Istanbul"
            },
            "name": "Cron",
            "type": "n8n-nodes-base.cron",
            "typeVersion": 1,
            "position": [
                250,
                300
            ]
        },
        {
            "parameters": {
                "resource": "message",
                "operation": "getAll",
                "searchQuery": "newer_than:1d",
                "options": {
                    "maxResults": 20,
                    "orderBy": "newest"
                }
            },
            "name": "Gmail",
            "type": "n8n-nodes-base.gmail",
            "typeVersion": 1,
            "position": [
                450,
                300
            ],
            "credentials": {
                "gmailOAuth2Api": "Gmail OAuth2"
            }
        },
        {
            "parameters": {
                "values": {
                    "string": [
                        {
                            "name": "summaryInput",
                            "value": "={{ $json.subject + \"\\n\" + $json.body }}"
                        }
                    ]
                },
                "options": []
            },
            "name": "Set",
            "type": "n8n-nodes-base.set",
            "typeVersion": 2,
            "position": [
                650,
                300
            ]
        },
        {
            "parameters": {
                "functionCode": "const combined = items.map(item => item.json.summaryInput).join('\\n---\\n');\nreturn [{ json: { summaryInput: combined } }];"
            },
            "name": "Combine",
            "type": "n8n-nodes-base.function",
            "typeVersion": 1,
            "position": [
                850,
                300
            ]
        },
        {
            "parameters": {
                "model": "gpt-4o-mini",
                "temperature": 0.3,
                "maxTokens": 300,
                "systemMessage": "",
                "messages": [
                    {
                        "role": "user",
                        "content": "Aşağıdaki e‑postaları Türkçe olarak, en fazla 150 kelimeyle özetle:\n{{ $json.summaryInput }}"
                    }
                ]
            },
            "name": "OpenAI",
            "type": "n8n-nodes-base.openAi",
            "typeVersion": 1,
            "position": [
                1050,
                300
            ],
            "credentials": {
                "openAiApi": "OpenAI API"
            }
        },
        {
            "parameters": {
                "conditions": {
                    "boolean": [
                        {
                            "value1": "={{ $json.choices && $json.choices[0] && $json.choices[0].message && $json.choices[0].message.content !== '' }}",
                            "operation": "equal"
                        }
                    ]
                }
            },
            "name": "IF",
            "type": "n8n-nodes-base.if",
            "typeVersion": 1,
            "position": [
                1250,
                300
            ]
        },
        {
            "parameters": {
                "fromEmail": "n8n@yourdomain.com",
                "toEmail": "YOUR_EMAIL@example.com",
                "subject": "Günlük Gmail Özeti",
                "text": "={{ $json.choices[0].message.content }}",
                "options": []
            },
            "name": "EmailSend",
            "type": "n8n-nodes-base.emailSend",
            "typeVersion": 1,
            "position": [
                1450,
                250
            ],
            "credentials": {
                "smtp": "SMTP Credentials"
            }
        }
    ],
    "connections": {
        "Cron": {
            "main": [
                [
                    {
                        "node": "Gmail",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Gmail": {
            "main": [
                [
                    {
                        "node": "Set",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Set": {
            "main": [
                [
                    {
                        "node": "Combine",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Combine": {
            "main": [
                [
                    {
                        "node": "OpenAI",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "OpenAI": {
            "main": [
                [
                    {
                        "node": "IF",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "IF": {
            "main": [
                [
                    {
                        "node": "EmailSend",
                        "type": "main",
                        "index": 0
                    }
                ],
                [
                    {
                        "node": "NoOp",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        }
    },
    "active": false,
    "settings": [],
    "id": "1"
}