8
n8n 中文网amn8n.com

使用GPT-4o-mini和Gmail生成并邮件发送个性化笑话

中级

这是一个Personal Productivity, Multimodal AI领域的自动化工作流,包含 8 个节点。主要使用 Set, Gmail, FormTrigger, OpenAi 等节点。 使用GPT-4o-mini和Gmail生成并邮件发送个性化笑话

前置要求
  • Google 账号和 Gmail API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "d42513f5d6883919549e0ea285413a7135f4af5b763e8a62e3bba6cf29ba1b7d",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "8803d5e4-bab6-43bc-95f1-8f15b8919ce2",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -40,
        0
      ],
      "webhookId": "480b013d-2fc7-4102-b4b6-2bc19dda1ae9",
      "parameters": {
        "options": {},
        "formTitle": "Chistes generator",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Nombre 1",
              "placeholder": "Juan"
            },
            {
              "fieldLabel": "Nombre 2",
              "placeholder": "laptop"
            },
            {
              "fieldLabel": "Nombre 3",
              "placeholder": "Maria"
            }
          ]
        },
        "formDescription": "Generador de chistes, introduce tres nombres o objetos que quieras que aparezcan en su chiste y a continuación se generará un chiste en base a ellos."
      },
      "typeVersion": 2.2
    },
    {
      "id": "265d6261-94ad-4b5b-8d23-aa21acd2a691",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        480,
        0
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Tu tarea es generar un chiste que contenga estas palabras:\n{{ $('On form submission').item.json['Nombre 1'] }}\n{{ $('On form submission').item.json['Nombre 2'] }}\ny {{ $('On form submission').item.json['Nombre 3'] }}\n\nHaz el chiste ne este idioma:  {{ $json.language }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "cX8zQBWEHG5KPcm5",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "25520990-e524-4a50-a580-3baa66a00743",
      "name": "LANG",
      "type": "n8n-nodes-base.set",
      "position": [
        220,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "02b8c348-8a91-4483-a892-9295fb47e94c",
              "name": "language",
              "type": "string",
              "value": "spanish / español"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ec32b07e-c564-4fad-89b4-4f6c404ce431",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 180,
        "height": 300,
        "content": "### 设置输出语言"
      },
      "typeVersion": 1
    },
    {
      "id": "923419eb-d92a-4427-baa3-f0cc81e2d8b6",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        900,
        0
      ],
      "webhookId": "83d69414-0757-464f-878f-18773ea94998",
      "parameters": {
        "sendTo": "youremail@gmail.com",
        "message": "={{ $json.message.content }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "Joke generator"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "F30nvIjtBVCW3UYo",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f0669408-d067-48be-b7e4-0628ea36cf1a",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 260,
        "height": 100,
        "content": "### 提示消息(约使用200个令牌)"
      },
      "typeVersion": 1
    },
    {
      "id": "e08b2c13-b945-425c-b77a-d44a5749b6d8",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        860,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 180,
        "height": 300,
        "content": "### 配置邮件发送"
      },
      "typeVersion": 1
    },
    {
      "id": "e52cbc9f-a7dd-496a-a3d9-8793e33f28c5",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 180,
        "height": 300,
        "content": "根据需要修改字段,必要时可添加更多内容让笑话更具创意。"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "LANG": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "LANG",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 个人效率, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量8
分类2
节点类型5
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Oriol Seguí

Oriol Seguí

@oxsr11

Completion of a higher degree on the way to university (computer engineering)

外部链接
在 n8n.io 查看

分享此工作流