Automate emails with n8n, AI & Launix

Automate emails with n8n, AI & Launix

Imagine: A user simply clicks a button named "AI Reply" – and the incoming email is automatically answered. Behind it lies an elegant n8n workflow triggered by an AI node. Optionally, the Launix plugin can be used to integrate CRM data or log communication events.

1. Trigger: Click on "AI Reply" in Thunderbird

A special button in Thunderbird generates a signal (e.g., via webhook or local API) that starts the workflow in n8n. For this, the plugin Thunderbird AI Reply

2. Receive & generate AI response

The webhook of the email program button is received in n8n via webhook. An AI-Node (e.g. lmChatOpenAi) generates a suitable response based on the context and previous conversations.

3. Optional: CRM query via the Launix plugin

Do you want to enrich the context? Then use the Launix plugin (n8n-nodes-launix), to retrieve, for example, customer data or conversation topics from the CRM.
The workflow could look like this:

4. Optional: Create support request / note in CRM

In parallel with the response, the workflow can save a new note or a communication event in the CRM. To do this:

5. Send answer

The generated answer is sent back to Thunderbird — either via an email node in n8n or via direct integration with Thunderbird.


Technical Implementation: Workflow Architecture

Here is a simplified overview:

  1. Trigger: Input signal (e.g., webhook from Thunderbird).
  2. AI-Node (lmChatOpenAi): Generated answer.
  3. Optional: Launix-Node – Data query from CRM.
  4. Optional: Launix-Node – Create note in CRM.
  5. Output: Send reply back to Thunderbird.

Here is the code for the node:

{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "d9e42f02-c5b7-4d14-ba98-e2feb8f713b9",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -192,
        0
      ],
      "id": "d9e42f02-c5b7-4d14-ba98-e2feb8f713b9",
      "name": "Webhook",
      "webhookId": "d9e42f02-c5b7-4d14-ba98-e2feb8f713b9"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\n  \"code\": 200,\n  \"message\": {{ JSON.stringify($json.data) }}\n} ",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        1040,
        0
      ],
      "id": "508c0cde-99fa-4c07-bf2c-d20fbc6e6e84",
      "name": "Respond to Webhook"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Subject: {{ $json.body.subject }}\nTo: {{ $json.body.to[0] }}\nFrom: {{ $json.body.from }}\n\n{{ $json.data }}",
        "options": {
          "systemMessage": "Du bist Carl-Philip Hänsch, CEO von Launix Inh.\n\nDu beantwortest die zitierte E-Mail als Carl-Philip Hänsch. Dabei bleibst du förmlich und höflich, aber trotzdem nett. Sprich den Absender direkt mit seinem Namen an.\n\nVerabschiede dich mit den Worten:\n\nMit freundlichen Grüßen,\nCarl-Philip Hänsch\n\nFolgende Antworten könntest du geben:\n - wenn jemand einen Fehler meldet, bestätige dem Kunden, dass du dich darum kümmerst\n - wenn jemand einen Termin möchte, antworte mit der Möglichkeit, einen Terminslot machen zu können [Termin vereinbaren](https://tidycal.com/launix/kennenlernen-launix)\n - Sollte es sich um eine Absage handelt, drücken Sie Ihr Bedauern aus und weisen darauf hin, dass wir weiterhin für eine Zusammenarbeit offen sind\n - wenn es in den Kontext passt, biete den [Katalog](https://launix.de/Launix-Katalog.pdf) an"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        416,
        0
      ],
      "id": "643ab3f9-36be-4150-8611-423a56462467",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        288,
        208
      ],
      "id": "f48fcdc5-6307-4747-b1f1-e6868dc2b1fb",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "ujhfcXIxASBxHBsr",
          "name": "OpenAi account 2"
        }
      }
    },
    {
      "parameters": {
        "mode": "markdownToHtml",
        "markdown": "={{ $json.output }}",
        "options": {}
      },
      "type": "n8n-nodes-base.markdown",
      "typeVersion": 1,
      "position": [
        768,
        0
      ],
      "id": "aec224ce-36db-4220-82f4-09652700e965",
      "name": "Markdown"
    },
    {
      "parameters": {
        "html": "={{ $json.body.body }}",
        "options": {}
      },
      "type": "n8n-nodes-base.markdown",
      "typeVersion": 1,
      "position": [
        16,
        0
      ],
      "id": "b0fc3ff3-4d64-401c-9296-15b74d60e4b2",
      "name": "Markdown1"
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Markdown1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Markdown": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Markdown1": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "5d646b97a6f5b390970161e7d5b6c2999c720df20b57515df0439cbab498ca6c"
  }
}

This setup follows the Launix-n8n integration as shown in their tutorials:


Benefits of this automation


Conclusion & Recommendation

With this n8n workflow, an automated email response with AI support can be implemented in no time – perfectly integrated with corporate processes via the Launix CRM. The approach is efficient, personalized, and documentation-friendly.

If you'd like, I can also put together example code for the corresponding n8n nodes, webhooks, or the AI prompt structure. Just let me know!

Категории