Telegramサポート取り扱いの自動化
上級
これはSupport Chatbot, AI Chatbot分野の自動化ワークフローで、40個のノードを含みます。主にIf, Set, Switch, Telegram, DataTableなどのノードを使用。 GPT-4とメール通知を使用して、TelegramサポートからAIから人間への段階の移行を自動化
前提条件
- •Telegram Bot Token
- •ターゲットAPIの認証情報が必要な場合あり
- •OpenAI API Key
使用ノード (40)
カテゴリー
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"meta": {
"instanceId": "cfcdd4aa7acb600106c0a4bff4e6959e8e3b32b3b8cbc7d93531b2a4c9012a32"
},
"nodes": [
{
"id": "2dabfa67-8f0b-4662-a929-df1e5bb7037e",
"name": "Telegramトリガー",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
16,
448
],
"webhookId": "5e5e14f9-5505-466d-b367-7b724bbc0eb5",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "b952c1e1-1377-4205-9c92-0702cac12708",
"name": "設定",
"type": "n8n-nodes-base.set",
"position": [
608,
528
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "4439ddcb-8bf4-4f40-8461-02f8ba5795d9",
"name": "user",
"type": "string",
"value": "={{ $('Telegram Trigger').item.json.message.from.id }}"
},
{
"id": "c7c23d1c-8325-485a-82b3-784a45f0c7cc",
"name": "smtp",
"type": "string",
"value": "SMTP_ACCOUNT_MAIL"
},
{
"id": "a20a4051-2916-4072-a156-6cc9efeb18d4",
"name": "operator",
"type": "string",
"value": "OPERATOR_MAIL"
},
{
"id": "b94071df-a56f-4ee7-a260-536924518fcb",
"name": "personal",
"type": "string",
"value": "YOUR_PERSONAL_ID(TELEGRAM)"
},
{
"id": "6e49c76e-3308-4691-8996-a98b4e1fcbd8",
"name": "group",
"type": "string",
"value": "GROUP_ID"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "894b9666-fa3f-485c-8330-4890542c65e2",
"name": "担当者確認",
"type": "n8n-nodes-base.telegram",
"position": [
1680,
480
],
"webhookId": "24b54c8f-858f-4313-84f5-8d7190ccfd3a",
"parameters": {
"chatId": "={{ $('Configuration').item.json.user }}",
"message": "Confirm switching to operator?",
"options": {
"appendAttribution": false
},
"operation": "sendAndWait",
"approvalOptions": {
"values": {
"approvalType": "double"
}
}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "d82fb377-0efe-43a7-ae6f-73d577b0e3c9",
"name": "ユーザー承認済み",
"type": "n8n-nodes-base.if",
"position": [
1856,
480
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "85d3c27f-d003-4d7c-b0ff-65574db8385c",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.data.approved }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "4e9e61ed-ba5c-4450-8ee7-f9ea832ba16d",
"name": "担当者通知",
"type": "n8n-nodes-base.emailSend",
"position": [
2048,
416
],
"webhookId": "70b1a1dd-4530-4ecb-96d0-f8179cf3e7e6",
"parameters": {
"message": "=User called {{ $('Telegram Trigger').item.json.message.from.username }} has requested an operator in Telegram chat. Please approve this message if the operator will be attending.\n\n**This message will expire in 15 minutes.**\n",
"options": {
"limitWaitTime": {
"values": {
"resumeUnit": "minutes",
"resumeAmount": 15
}
},
"appendAttribution": false
},
"subject": "User Requires Attention",
"toEmail": "={{ $('Configuration').item.json.operator }}",
"fromEmail": "={{ $('Configuration').item.json.smtp }}",
"operation": "sendAndWait",
"approvalOptions": {
"values": {
"approveLabel": "Create Topic"
}
}
},
"credentials": {
"smtp": {
"id": "4DkwbpaAtif3n8IV",
"name": "SMTP MookieLianHD Gmail"
}
},
"typeVersion": 2.1
},
{
"id": "ba253ae3-9c3f-49b9-be17-38c039cf75b6",
"name": "OpenRouterチャットモデル",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
1184,
768
],
"parameters": {
"model": "x-ai/grok-4-fast",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "d23pUD37RPrT3pC2",
"name": "OpenRouter account"
}
},
"typeVersion": 1
},
{
"id": "3e5cf322-3f81-460e-8d69-8814c518d504",
"name": "担当者確定",
"type": "n8n-nodes-base.if",
"position": [
2224,
416
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d06816f2-6906-4167-a7f5-acb348f5678c",
"operator": {
"type": "boolean",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.data.approved }}",
"rightValue": ""
},
{
"id": "524fefa4-f84b-4725-8500-f8ed9b788bd0",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.data.approved }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "4bfcbf4e-1b16-4993-8b9a-1711fcda85f1",
"name": "担当者出勤",
"type": "n8n-nodes-base.telegram",
"position": [
2416,
336
],
"webhookId": "6952808f-55d4-4766-9448-d1f28e1006b2",
"parameters": {
"text": "Operator will be with you shortly.",
"chatId": "={{ $('Configuration').item.json.user }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "111c38e7-f287-4414-9e8c-6040f322ad1a",
"name": "担当者出勤拒否",
"type": "n8n-nodes-base.telegram",
"position": [
2416,
496
],
"webhookId": "6952808f-55d4-4766-9448-d1f28e1006b2",
"parameters": {
"text": "Unfortunately, the operator is not free at the moment.",
"chatId": "={{ $('Configuration').item.json.user }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "e48beba6-5267-489a-a929-0f8b019f5919",
"name": "AIエージェント",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1184,
608
],
"parameters": {
"text": "={{ $('Telegram Trigger').item.json.message.text }}",
"options": {
"systemMessage": "You are a helpful assistant on Telegram platform. To reply to users, call 'Reply to User' tool.\n\n**Critical: Call 'Reply to User' tool once.\n\n**Critical: When users ask to chat with a human agent, reply with 'Human' instead, with no punctuation marks. Do not call the 'Reply To User' tool in this case.**"
},
"promptType": "define",
"needsFallback": true
},
"typeVersion": 2.2
},
{
"id": "8cfdfc0a-893c-4b6c-99df-b3254ad809a4",
"name": "シンプルメモリ",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
1280,
1104
],
"parameters": {
"sessionKey": "={{ $('Configuration').item.json.user }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "4016ffe6-e825-4f92-95b2-082dec181696",
"name": "ユーザーへの返信",
"type": "n8n-nodes-base.telegramTool",
"position": [
1328,
800
],
"webhookId": "32b26e29-eae9-48fa-939b-7fc142656da5",
"parameters": {
"text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', `Reply message to be sent to user.`, 'string') }}",
"chatId": "={{ $('Configuration').item.json.user }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "a8033517-b6e8-44f9-87d2-2a228f396245",
"name": "人間対応要請",
"type": "n8n-nodes-base.if",
"position": [
1488,
608
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2c353a33-ef9c-4ef5-b019-7875e8f80d85",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output }}",
"rightValue": "Human"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "bfe3aa80-2b10-4dd2-8544-e9456a37d0a0",
"name": "Azure OpenAIチャットモデル",
"type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
"position": [
1232,
928
],
"parameters": {
"model": "gpt-4o-mini",
"options": {}
},
"credentials": {
"azureOpenAiApi": {
"id": "4WyMLAYYCsugTVtc",
"name": "Azure Open AI account"
}
},
"typeVersion": 1
},
{
"id": "6dca4f2a-7f5a-49e3-93a2-e3ed0b21b14a",
"name": "最終メッセージ更新",
"type": "n8n-nodes-base.dataTable",
"position": [
2048,
816
],
"parameters": {
"columns": {
"value": {
"type": "ai"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "user",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "user",
"defaultMatch": false
},
{
"id": "topic",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "topic",
"defaultMatch": false
},
{
"id": "status",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "status",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"filters": {
"conditions": [
{
"keyName": "user",
"keyValue": "={{ $('Configuration').item.json.user }}"
}
]
},
"options": {},
"operation": "update",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1
},
{
"id": "84786a93-07fe-47ac-96f5-54f4a2c76e83",
"name": "最終メッセージ存在",
"type": "n8n-nodes-base.dataTable",
"position": [
1680,
736
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "user",
"keyValue": "={{ $('Configuration').item.json.user }}"
},
{
"keyName": "status",
"keyValue": "open"
}
]
},
"operation": "rowExists",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "a27e8718-7b93-4460-9183-c80453158b54",
"name": "行が空",
"type": "n8n-nodes-base.if",
"position": [
1856,
736
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "76c55b53-23a0-4afc-8250-e3d230286d61",
"operator": {
"type": "object",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "539e9e73-006b-4ef0-8dc3-ee3c2bcaf27e",
"name": "一時メッセージ作成",
"type": "n8n-nodes-base.dataTable",
"position": [
2048,
656
],
"parameters": {
"columns": {
"value": {
"type": "ai",
"user": "={{ $('Configuration').item.json.user }}",
"status": "open"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "user",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "user",
"defaultMatch": false
},
{
"id": "topic",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "topic",
"defaultMatch": false
},
{
"id": "status",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "status",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1
},
{
"id": "0055bb76-2c3c-49ad-8381-21b951bfa3a0",
"name": "一時メッセージ更新",
"type": "n8n-nodes-base.dataTable",
"position": [
2784,
336
],
"parameters": {
"columns": {
"value": {
"type": "human",
"topic": "={{ $json.result.message_thread_id }}",
"status": "open"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "user",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "user",
"defaultMatch": false
},
{
"id": "topic",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "topic",
"defaultMatch": false
},
{
"id": "status",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "status",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"filters": {
"conditions": [
{
"keyName": "user",
"keyValue": "={{ $('Configuration').item.json.user }}"
}
]
},
"options": {},
"operation": "update",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1
},
{
"id": "491171e9-75d7-429b-a280-2d099d9d6ab3",
"name": "一時メッセージ取得",
"type": "n8n-nodes-base.dataTable",
"position": [
784,
528
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "user",
"keyValue": "={{ $json.user }}"
},
{
"keyName": "status",
"keyValue": "open"
}
]
},
"matchType": "allConditions",
"operation": "get",
"returnAll": true,
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "ba334b52-a555-4d95-9eae-a840f5dbfd84",
"name": "メッセージルーター",
"type": "n8n-nodes-base.switch",
"position": [
976,
512
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "human",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2d381ff5-c197-4de5-90ab-43e1163d8f74",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.type }}",
"rightValue": "human"
}
]
},
"renameOutput": true
},
{
"outputKey": "empty",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "ca6f18b7-cc9f-4058-b134-f6cb731a0bd6",
"operator": {
"type": "object",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "ai",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4a69a2ff-9ee3-476d-bef9-b82a7fe673a7",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.type }}",
"rightValue": "ai"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.3
},
{
"id": "4183f326-c94f-46ad-a86f-30aee2edcd7e",
"name": "個人",
"type": "n8n-nodes-base.set",
"position": [
3280,
736
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "4439ddcb-8bf4-4f40-8461-02f8ba5795d9",
"name": "personal",
"type": "string",
"value": "={{ $json.message.from.id }}"
},
{
"id": "899b32df-0124-4751-a09b-21e0afa9b3e6",
"name": "group",
"type": "string",
"value": "={{ $json.message.chat.id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "befed495-26fc-45d4-a8d6-66d6b314b201",
"name": "トピック作成",
"type": "n8n-nodes-base.httpRequest",
"position": [
2592,
336
],
"parameters": {
"url": "https://api.telegram.org/botBOT_TOKEN/createForumTopic",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Configuration').item.json.group }}"
},
{
"name": "name",
"value": "={{ $('Configuration').item.json.user }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "72ce66dd-e1b0-4d97-9b69-1337f8c2d01a",
"name": "テキストメッセージ",
"type": "n8n-nodes-base.if",
"position": [
400,
608
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "10537cf3-851f-48c1-94cb-739a47f0cd58",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.text }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "13e7a069-6cdd-485e-bdf9-48e3fd55e19e",
"name": "ワークフロー停止",
"type": "n8n-nodes-base.noOp",
"position": [
608,
688
],
"parameters": {},
"typeVersion": 1
},
{
"id": "b5a3d335-b762-4331-a051-3d75e5258788",
"name": "グループへのメッセージ転送",
"type": "n8n-nodes-base.httpRequest",
"position": [
1184,
432
],
"parameters": {
"url": "https://api.telegram.org/botBOT_TOKEN/forwardMessage",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Configuration').item.json.group }}"
},
{
"name": "from_chat_id",
"value": "={{ $('Configuration').item.json.user }}"
},
{
"name": "message_id",
"value": "={{ $('Telegram Trigger').item.json.message.message_id }}"
},
{
"name": "message_thread_id",
"value": "={{ $('Get Temporary Message').item.json.topic }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "a90da098-55c7-4d79-8cd9-438cdaff33ff",
"name": "トピックメッセージ",
"type": "n8n-nodes-base.if",
"position": [
176,
448
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d5a195e5-5d30-4404-897c-972154ae4776",
"operator": {
"type": "boolean",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.is_topic_message }}",
"rightValue": ""
},
{
"id": "1ca6b333-5a2e-4196-98da-ddb9c81a0d74",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.message.is_topic_message }}",
"rightValue": ""
},
{
"id": "e07c655e-c4ae-4883-bc15-a39ee6e6dd93",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.text }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "29fe28b7-3973-41ec-b9c4-c04ce6f9496a",
"name": "チャット管理者",
"type": "n8n-nodes-base.httpRequest",
"position": [
3200,
1024
],
"parameters": {
"url": "https://api.telegram.org/botYOUR_TOKEN/getChatAdministrators",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "=GROUP_ID"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "e64ca366-4c82-4693-90b0-75e36f2775a3",
"name": "メッセージ転送",
"type": "n8n-nodes-base.httpRequest",
"position": [
608,
368
],
"parameters": {
"url": "https://api.telegram.org/botBOT_TOKEN/forwardMessage",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Telegram Trigger').item.json.message.reply_to_message.forum_topic_created.name }}"
},
{
"name": "from_chat_id",
"value": "={{ $('Telegram Trigger').item.json.message.reply_to_message.chat.id }}"
},
{
"name": "message_id",
"value": "={{ $('Telegram Trigger').item.json.message.message_id }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "b5f03bf1-d898-4b3b-bbaf-bf7092100420",
"name": "個人トリガー",
"type": "n8n-nodes-base.telegramTrigger",
"disabled": true,
"position": [
3136,
736
],
"webhookId": "5e5e14f9-5505-466d-b367-7b724bbc0eb5",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "ce4fd19f-1ee3-4932-a43c-0838e5f95a4e",
"name": "終了",
"type": "n8n-nodes-base.if",
"position": [
400,
288
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bc53c1d9-bfee-40f8-8cbf-f78757526fa1",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Telegram Trigger').item.json.message.text }}",
"rightValue": "exit"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "420d646c-8db9-4c61-9517-42ec946bd4e8",
"name": "トピック閉鎖",
"type": "n8n-nodes-base.httpRequest",
"position": [
608,
192
],
"parameters": {
"url": "https://api.telegram.org/botBOT_TOKEN/closeForumTopic",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Telegram Trigger').item.json.message.reply_to_message.chat.id }}"
},
{
"name": "message_thread_id",
"value": "={{ $('Telegram Trigger').item.json.message.reply_to_message.message_thread_id }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "ada57ab7-782d-4bcf-8c24-3e68afd8aa37",
"name": "閉鎖トピック更新",
"type": "n8n-nodes-base.dataTable",
"position": [
784,
192
],
"parameters": {
"columns": {
"value": {
"status": "closed"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "user",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "user",
"defaultMatch": false
},
{
"id": "topic",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "topic",
"defaultMatch": false
},
{
"id": "status",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "status",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"filters": {
"conditions": [
{
"keyName": "topic",
"keyValue": "={{ $('Telegram Trigger').item.json.message.reply_to_message.message_thread_id }}"
}
]
},
"options": {},
"operation": "update",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1
},
{
"id": "120db6ad-faf1-4117-82ab-f878d6bc37dd",
"name": "付箋17",
"type": "n8n-nodes-base.stickyNote",
"position": [
2336,
1200
],
"parameters": {
"color": 5,
"width": 1680,
"height": 80,
"content": "# Credentials"
},
"typeVersion": 1
},
{
"id": "7dca3dc6-3735-49c6-85fd-10b4a4f3326b",
"name": "付箋18",
"type": "n8n-nodes-base.stickyNote",
"position": [
2976,
272
],
"parameters": {
"color": 6,
"width": 560,
"height": 928,
"content": "## Telegram - [Docs](https://docs.n8n.io/integrations/builtin/credentials/telegram/)\n\n### Bot Creation\n1. Message BotFather, create new bot and copy token.\n2. Paste token in n8n and save credentials. Name it something unique to identify it(e.g. Handover Bot). \n\n### Group Creation/Support UI\n1. Create a new group from Telegram dropdown menu. Go to Settings and enable Topics. Telegram will automatically create General topic.\n2. From Settings go to Administrators and add your bot as admin. Give 'Read and Manage Topics' permissions.\n\n### Related to Workflow\n\n- To get your group id and personal id deactivate main trigger and activate the one below. Send a message to your group and come back to executions tab. These ID's are required for Configuration node.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n- To check if the Bot is properly added to your group as admin(sometimes n8n doesn't see the bot as admin) execute the node below with correct parameters. Keep in mind that you have to add your Bot Token to all HTTP Request nodes."
},
"typeVersion": 1
},
{
"id": "9c27036e-b7eb-4e71-86ef-cbfbd93ae9ff",
"name": "付箋19",
"type": "n8n-nodes-base.stickyNote",
"position": [
3568,
432
],
"parameters": {
"color": 6,
"width": 448,
"height": 768,
"content": "## Configuration Node\n\n### SMTP Mail - [Docs](https://docs.n8n.io/integrations/builtin/credentials/sendemail/#related-resources)\n- Type in the the SMTP email that you created the credential with.\n- Here is how to setup the credentials for Gmail:\n\n1. Enable 2FA if you haven't already.\n2. Generate an app password and copy it.\n3. In n8n credential page follow these steps:\n\n1. Enter your Gmail email address as the User.\n2. Enter the app password you copied as the Password.\n3. Enter smtp.gmail.com as the Host.\n4. For the Port:\nKeep the default 465 for SSL or if you're unsure what to use.\nEnter 587 for TLS.\n5. Turn on the SSL/TLS toggle.\n\n### Operator\n- Type in the mail address which will receive the alert. Topic will be created only if the mail is confirmed.\n\n### Personal\n- This parameter is not required. Currently not being used in the workflow. You can type it in and use expressions to test pinned data. Otherwise, remove it.\n\n### Group ID\n- Type in the group id that you received from 'Personal Trigger'. Usually starts with '-10...'. This parameter is required."
},
"typeVersion": 1
},
{
"id": "9543d11d-2d11-4785-8534-d952c5952f57",
"name": "付箋20",
"type": "n8n-nodes-base.stickyNote",
"position": [
2336,
752
],
"parameters": {
"color": 6,
"width": 592,
"height": 448,
"content": "## Data Tables - n8n\n\n### Creating a Table\n1. From n8n dashboard go to data tables section. Create a new table.\n2. Add type(string), status(string), topic(number), user(number) columns. **Make sure that each column exists**, otherwise workflow will return an error.\n\n### Alternatives\n- Data tables in n8n are for development stage. If you wish to scale this workflow and work with much bigger data **use hosted databases** (Postgres, Redis etc.)\n\n### Notes\n\n- In this workflow template, data tables are being used to track chat type('human', 'ai' etc.). However when your operator types in 'exit' in the Telegram topic, this row is not deleted. Its status column updates to 'closed'. This is **close to having a ticket system** where each ticket is saved as a row inside a database."
},
"typeVersion": 1
},
{
"id": "0b52da6c-a05e-4b00-b981-01a4d61a2b68",
"name": "付箋21",
"type": "n8n-nodes-base.stickyNote",
"position": [
576,
960
],
"parameters": {
"color": 4,
"width": 560,
"height": 384,
"content": "# Overview Video - 1 Minute\n[](https://youtu.be/U1HBdilbvzc)"
},
"typeVersion": 1
},
{
"id": "4478a416-f352-4f2b-924c-95a2cbdf18ca",
"name": "付箋22",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
912
],
"parameters": {
"color": 4,
"width": 560,
"height": 432,
"content": "# Detailed Setup Video - 10 Minutes\n[](https://youtu.be/Rjj_g9HEuqw)"
},
"typeVersion": 1
},
{
"id": "55172322-f2fe-4245-996e-254ddfcef702",
"name": "付箋1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-624,
192
],
"parameters": {
"color": 5,
"width": 576,
"height": 1152,
"content": "# Welcome\n\nTelegram Handover Template by [mookielian](https://n8n.io/creators/mookielian)!\n\n## Before You Start\n\nThis template requires **intermediate knowledge** of workflow logic and APIs. A detailed video guide is available, but please review each node and understand the basics before starting. Consider using the [Telegram Extended community node](https://www.npmjs.com/package/n8n-nodes-telegram-extended) for easier forum operations.\n\n## Quick Setup\n\n### 1. Prerequisites\n\nCreate a Telegram bot via BotFather, set up a group with Topics enabled, add your bot as admin, and prepare a data table with columns: `user`, `type`, `topic`, and `status`. Configure SMTP for operator email alerts.\n\n### 2. Key Nodes\n\n**Configuration Node**: Set operator email and Telegram group chat ID.\n\n**Telegram Trigger**: Connect bot credentials to receive all updates.\n\n**AI Agent**: Select your AI model and customize the system prompt while keeping critical headers. The \"Reply To User\" tool sends Telegram messages. Memory uses a 5-message buffer (upgrade to database for production).\n\n**Data Tables**: Ensure column names match exactly: `user`, `type`, `topic`, `status`.\n\n### 3. How It Works\n\nOperator messages in topics forward to users (\"exit\" closes topics). User DMs route based on status: new/AI users go to the AI agent, human status users forward to operator topics.\n\nHandover flow: AI detects need → asks user confirmation → emails operator → operator confirms → creates topic → updates status → notifies user.\n\n### 4. Production Checklist\n\n- Replace memory buffer with proper database\n- Customize AI system prompt for your use case\n- Test handover scenarios thoroughly\n- Set up monitoring and rate limiting\n\n**Note**: Currently text-only. File processing is blocked to save tokens but can be modified if needed."
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"ce4fd19f-1ee3-4932-a43c-0838e5f95a4e": {
"main": [
[
{
"node": "420d646c-8db9-4c61-9517-42ec946bd4e8",
"type": "main",
"index": 0
}
],
[
{
"node": "e64ca366-4c82-4693-90b0-75e36f2775a3",
"type": "main",
"index": 0
}
]
]
},
"e48beba6-5267-489a-a929-0f8b019f5919": {
"main": [
[
{
"node": "a8033517-b6e8-44f9-87d2-2a228f396245",
"type": "main",
"index": 0
}
]
]
},
"420d646c-8db9-4c61-9517-42ec946bd4e8": {
"main": [
[
{
"node": "ada57ab7-782d-4bcf-8c24-3e68afd8aa37",
"type": "main",
"index": 0
}
]
]
},
"befed495-26fc-45d4-a8d6-66d6b314b201": {
"main": [
[
{
"node": "0055bb76-2c3c-49ad-8381-21b951bfa3a0",
"type": "main",
"index": 0
}
]
]
},
"a27e8718-7b93-4460-9183-c80453158b54": {
"main": [
[
{
"node": "539e9e73-006b-4ef0-8dc3-ee3c2bcaf27e",
"type": "main",
"index": 0
}
],
[
{
"node": "6dca4f2a-7f5a-49e3-93a2-e3ed0b21b14a",
"type": "main",
"index": 0
}
]
]
},
"72ce66dd-e1b0-4d97-9b69-1337f8c2d01a": {
"main": [
[
{
"node": "b952c1e1-1377-4205-9c92-0702cac12708",
"type": "main",
"index": 0
}
],
[
{
"node": "13e7a069-6cdd-485e-bdf9-48e3fd55e19e",
"type": "main",
"index": 0
}
]
]
},
"b952c1e1-1377-4205-9c92-0702cac12708": {
"main": [
[
{
"node": "491171e9-75d7-429b-a280-2d099d9d6ab3",
"type": "main",
"index": 0
}
]
]
},
"4016ffe6-e825-4f92-95b2-082dec181696": {
"ai_tool": [
[
{
"node": "e48beba6-5267-489a-a929-0f8b019f5919",
"type": "ai_tool",
"index": 0
}
]
]
},
"8cfdfc0a-893c-4b6c-99df-b3254ad809a4": {
"ai_memory": [
[
{
"node": "e48beba6-5267-489a-a929-0f8b019f5919",
"type": "ai_memory",
"index": 0
}
]
]
},
"a90da098-55c7-4d79-8cd9-438cdaff33ff": {
"main": [
[
{
"node": "ce4fd19f-1ee3-4932-a43c-0838e5f95a4e",
"type": "main",
"index": 0
}
],
[
{
"node": "72ce66dd-e1b0-4d97-9b69-1337f8c2d01a",
"type": "main",
"index": 0
}
]
]
},
"d82fb377-0efe-43a7-ae6f-73d577b0e3c9": {
"main": [
[
{
"node": "4e9e61ed-ba5c-4450-8ee7-f9ea832ba16d",
"type": "main",
"index": 0
}
],
[
{
"node": "e48beba6-5267-489a-a929-0f8b019f5919",
"type": "main",
"index": 0
}
]
]
},
"4e9e61ed-ba5c-4450-8ee7-f9ea832ba16d": {
"main": [
[
{
"node": "3e5cf322-3f81-460e-8d69-8814c518d504",
"type": "main",
"index": 0
}
]
]
},
"ba334b52-a555-4d95-9eae-a840f5dbfd84": {
"main": [
[
{
"node": "b5a3d335-b762-4331-a051-3d75e5258788",
"type": "main",
"index": 0
}
],
[
{
"node": "e48beba6-5267-489a-a929-0f8b019f5919",
"type": "main",
"index": 0
}
],
[
{
"node": "e48beba6-5267-489a-a929-0f8b019f5919",
"type": "main",
"index": 0
}
]
]
},
"a8033517-b6e8-44f9-87d2-2a228f396245": {
"main": [
[
{
"node": "894b9666-fa3f-485c-8330-4890542c65e2",
"type": "main",
"index": 0
}
],
[
{
"node": "84786a93-07fe-47ac-96f5-54f4a2c76e83",
"type": "main",
"index": 0
}
]
]
},
"894b9666-fa3f-485c-8330-4890542c65e2": {
"main": [
[
{
"node": "d82fb377-0efe-43a7-ae6f-73d577b0e3c9",
"type": "main",
"index": 0
}
]
]
},
"b5f03bf1-d898-4b3b-bbaf-bf7092100420": {
"main": [
[
{
"node": "4183f326-c94f-46ad-a86f-30aee2edcd7e",
"type": "main",
"index": 0
}
]
]
},
"2dabfa67-8f0b-4662-a929-df1e5bb7037e": {
"main": [
[
{
"node": "a90da098-55c7-4d79-8cd9-438cdaff33ff",
"type": "main",
"index": 0
}
]
]
},
"3e5cf322-3f81-460e-8d69-8814c518d504": {
"main": [
[
{
"node": "4bfcbf4e-1b16-4993-8b9a-1711fcda85f1",
"type": "main",
"index": 0
}
],
[
{
"node": "111c38e7-f287-4414-9e8c-6040f322ad1a",
"type": "main",
"index": 0
}
]
]
},
"84786a93-07fe-47ac-96f5-54f4a2c76e83": {
"main": [
[
{
"node": "a27e8718-7b93-4460-9183-c80453158b54",
"type": "main",
"index": 0
}
]
]
},
"4bfcbf4e-1b16-4993-8b9a-1711fcda85f1": {
"main": [
[
{
"node": "befed495-26fc-45d4-a8d6-66d6b314b201",
"type": "main",
"index": 0
}
]
]
},
"491171e9-75d7-429b-a280-2d099d9d6ab3": {
"main": [
[
{
"node": "ba334b52-a555-4d95-9eae-a840f5dbfd84",
"type": "main",
"index": 0
}
]
]
},
"ba253ae3-9c3f-49b9-be17-38c039cf75b6": {
"ai_languageModel": [
[
{
"node": "e48beba6-5267-489a-a929-0f8b019f5919",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"bfe3aa80-2b10-4dd2-8544-e9456a37d0a0": {
"ai_languageModel": [
[
{
"node": "e48beba6-5267-489a-a929-0f8b019f5919",
"type": "ai_languageModel",
"index": 1
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
上級 - サポートチャットボット, AIチャットボット
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
Azure OpenAI と Google テーブルを使ってメールを分類して Telegram へ通知を取得する
Azure OpenAIとGoogleスプレッドシートでメールを分類し、Telegramへアラート
If
Set
Telegram
+
If
Set
Telegram
27 ノードMeelioo
チケット管理
演示メール共有
AI、Telegramボット、ウェブスクレイピングを用いたパーソナライズされたメールアウトレ expressions
If
Set
Xml
+
If
Set
Xml
58 ノードMichael A Putra
リードナーチャリング
J.A.R.V.I.S.
Telegram上でOpenAI、SERP、ベクターストアを使った包括のなマルチモーダルアシスタントの構築
If
Set
Code
+
If
Set
Code
48 ノードFabioInTech
サポートチャットボット
WhatsApp / Telegram WooCommerce注文サポート
Telegram と Gmail を使用したGemini と GPT を使用した WooCommerce カスタマーサポートの自動化
Set
Gmail
Merge
+
Set
Gmail
Merge
25 ノードAppStoneLab Technologies LLP
サポートチャットボット
Telegram で医師を予約する
Telegram、Gemini AI、Google Sheetsを基にした医師予約スケジュールシステム
Set
Switch
Telegram
+
Set
Switch
Telegram
18 ノードAbdul Matheen
サポートチャットボット
ソーシャルメディアファクトリー
AIベースのソーシャルメディアコンテンツ作成ツール、マルチプラットフォーム公開と承認対応
If
Set
Gmail
+
If
Set
Gmail
48 ノードTaiki
ソーシャルメディア