This workflow corresponds to n8n.io template #3611 — we link there as the canonical source.
This workflow follows the Telegram → Telegram Trigger 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": "Vkw2rLJx7PuE9ev2",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "TG-Bot-Module-Giveaway-v4-db-sell-full",
"tags": [
{
"id": "EwFGeL3ePPNgm0R7",
"name": "telegram",
"createdAt": "2025-02-10T18:10:47.435Z",
"updatedAt": "2025-02-10T18:10:47.435Z"
},
{
"id": "XPad0ERjSdqfxG52",
"name": "module",
"createdAt": "2025-03-31T08:11:00.151Z",
"updatedAt": "2025-03-31T08:11:00.151Z"
},
{
"id": "2ocrWSzdKoCOU2AC",
"name": "sell",
"createdAt": "2025-04-19T15:39:51.859Z",
"updatedAt": "2025-04-19T15:39:51.859Z"
}
],
"nodes": [
{
"id": "a88a431f-4277-4ed0-91eb-17560a31b832",
"name": "Sticky Note14",
"type": "n8n-nodes-base.stickyNote",
"position": [
700,
560
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "0824d027-e77d-40a8-a8ce-0cbe035e1328",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
1160,
560
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "6b98af66-355c-417f-b0da-524c29fdd448",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-500,
1340
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "e08ddd2f-02b7-4b66-b701-7e9af06907e4",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1840,
1560
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "09741b6c-9357-4008-ad12-9f00ccec4338",
"name": "Initialization",
"type": "n8n-nodes-base.set",
"position": [
-40,
980
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "fffb74ce-86dc-4287-bbb6-a8f2ddafe091",
"name": "Welcome message Referal",
"type": "n8n-nodes-base.telegram",
"position": [
740,
580
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "187122c5-8089-4745-8f3e-7cae49fea60f",
"name": "Welcome message Manager",
"type": "n8n-nodes-base.telegram",
"position": [
740,
780
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "7a4135f6-fb98-43ca-b85a-a95f19a84de9",
"name": "Upsert bot status on START",
"type": "n8n-nodes-base.postgres",
"position": [
940,
780
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "2483ca3f-7158-455c-9250-65121bb16387",
"name": "Add participant in Giveaway",
"type": "n8n-nodes-base.postgres",
"position": [
1220,
580
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "cf7bc2c4-4d6c-42aa-a53a-8f3cf9b60079",
"name": "Get Bot Status",
"type": "n8n-nodes-base.postgres",
"position": [
740,
980
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "9bbf4db8-33e3-4cc1-9e6c-59f4552cd62e",
"name": "Start?",
"type": "n8n-nodes-base.if",
"position": [
160,
980
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "7b56225d-eab4-42d8-bb75-11afda52f1d2",
"name": "Button?",
"type": "n8n-nodes-base.if",
"position": [
340,
980
],
"parameters": {},
"typeVersion": 1
},
{
"id": "a5b60598-b688-467c-822b-6dc28a1ba4f2",
"name": "Referal?",
"type": "n8n-nodes-base.if",
"position": [
560,
780
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "ad57cb94-9804-4296-82b4-4b683c02295e",
"name": "Define flow",
"type": "n8n-nodes-base.switch",
"position": [
940,
980
],
"parameters": {},
"typeVersion": 3.2,
"alwaysOutputData": false
},
{
"id": "7dd5490c-633b-4727-8205-6b2945ec8ddc",
"name": "Commands",
"type": "n8n-nodes-base.switch",
"position": [
1220,
980
],
"parameters": {},
"retryOnFail": false,
"typeVersion": 3.2
},
{
"id": "60748e12-5dc3-4d5f-aa1f-f4c3a904eac9",
"name": "List Channels",
"type": "n8n-nodes-base.telegram",
"position": [
1440,
980
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "9ddfacd6-c3e3-4c01-91a5-8752b3bd8b31",
"name": "Add channel",
"type": "n8n-nodes-base.postgres",
"onError": "continueErrorOutput",
"position": [
1220,
1160
],
"parameters": {},
"retryOnFail": false,
"typeVersion": 2.5
},
{
"id": "bb74bc42-ef8b-4012-b7df-4bd12044652f",
"name": "Buttons",
"type": "n8n-nodes-base.switch",
"position": [
940,
1820
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "d7dff496-0cb0-4621-bb6e-08655f52829d",
"name": "Create Giveaway",
"type": "n8n-nodes-base.telegram",
"position": [
1440,
1820
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "4d86846a-9ace-47c7-8147-9520e7ecdb8f",
"name": "Request New Channel",
"type": "n8n-nodes-base.telegram",
"position": [
1440,
1160
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "6bd742a7-3d4f-4fd3-96f1-11919be7ea00",
"name": "Channel Exists",
"type": "n8n-nodes-base.telegram",
"position": [
1440,
1360
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "38eacfc8-96d8-4ad9-8e3f-acd9b830467b",
"name": "Define Step Giveaway",
"type": "n8n-nodes-base.switch",
"position": [
1220,
1580
],
"parameters": {},
"typeVersion": 3.2,
"alwaysOutputData": false
},
{
"id": "181f2e2e-e8c6-4b38-91c9-9a81238ef12a",
"name": "Get Participants",
"type": "n8n-nodes-base.postgres",
"position": [
1660,
1580
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "8355aa35-1d3a-4a88-8b54-4639e1f095be",
"name": "Random Participants",
"type": "n8n-nodes-base.sort",
"position": [
1880,
1580
],
"parameters": {},
"executeOnce": false,
"typeVersion": 1
},
{
"id": "3af0984f-f383-4fe1-bad1-4841b792c499",
"name": "Get Channels",
"type": "n8n-nodes-base.postgres",
"position": [
2080,
1580
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "32508ab0-b317-45f5-a683-217d2892b9ac",
"name": "Union Statuses",
"type": "n8n-nodes-base.aggregate",
"position": [
2500,
1580
],
"parameters": {},
"typeVersion": 1
},
{
"id": "34162676-517d-40c8-af24-280d521a2fc1",
"name": "Check Success?",
"type": "n8n-nodes-base.if",
"position": [
2700,
1580
],
"parameters": {},
"executeOnce": true,
"typeVersion": 2.2,
"alwaysOutputData": false
},
{
"id": "8ee97c98-5286-4850-912f-f4516e37d733",
"name": "Check Success",
"type": "n8n-nodes-base.telegram",
"disabled": true,
"position": [
2920,
1160
],
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "bcf02704-7d88-49a1-8c33-024d99131ec5",
"name": "Check Failed",
"type": "n8n-nodes-base.telegram",
"disabled": true,
"position": [
2920,
1360
],
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "0df05a53-83e5-4a39-9d68-a4d4cd22414d",
"name": "SMS for Winner",
"type": "n8n-nodes-base.telegram",
"position": [
2920,
1580
],
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "7a161f59-7603-4074-9e9d-2ff8b99b7b73",
"name": "SMS for Manager",
"type": "n8n-nodes-base.telegram",
"position": [
3100,
1580
],
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "97d03ad2-9adb-4364-9e50-bd1d53529a20",
"name": "Delete Channels",
"type": "n8n-nodes-base.postgres",
"position": [
3300,
1160
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "cbdda4cb-879f-472b-8de7-9f374fa690ef",
"name": "Delete Participants",
"type": "n8n-nodes-base.postgres",
"position": [
3300,
1360
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "5b72da60-2a11-44f9-a59a-2f702eeaec38",
"name": "End Message",
"type": "n8n-nodes-base.telegram",
"position": [
3480,
1580
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "3bc4e559-c026-4096-860e-ae7aa6045647",
"name": "Update bot status on GIVEAWAY RUN",
"type": "n8n-nodes-base.postgres",
"position": [
1220,
1820
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "6e137946-d9a6-43e9-bb12-3f9d3f13424b",
"name": "Update bot status on GIVEAWAY REQUEST CHANNEL",
"type": "n8n-nodes-base.postgres",
"position": [
1660,
980
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "5d00b729-3c03-4ca3-8a58-b9338d736742",
"name": "Update bot status and referal",
"type": "n8n-nodes-base.postgres",
"position": [
940,
580
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "83c8e09c-9f46-4bf5-9401-744c4e229338",
"name": "Update bot status on START ",
"type": "n8n-nodes-base.postgres",
"position": [
3300,
1580
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "b417847e-480c-485b-b19c-f06c98cb43cd",
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
2300,
1580
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "4b585aea-96f3-4745-a821-736ff0525387",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-960,
680
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "3fdb6f7f-7bfc-4184-b5e9-a93be2ca44c8",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-960,
1000
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "d587af11-5501-4853-8ca7-4a5834a896f9",
"name": "Variables TG",
"type": "n8n-nodes-base.set",
"position": [
-280,
980
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "26b42428-0d68-4760-a9ec-e62c505a995f",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-500,
980
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "ddd0b0a5-ce75-4ed4-800b-7e118b7a507d",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-960,
1340
],
"parameters": {
"content": ""
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "8d80b4ee-0bb7-428c-b04d-1b66c2541125",
"connections": {
"Start?": {
"main": [
[
{
"node": "Referal?",
"type": "main",
"index": 0
}
],
[
{
"node": "Button?",
"type": "main",
"index": 0
}
]
]
},
"Button?": {
"main": [
[
{
"node": "Buttons",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Bot Status",
"type": "main",
"index": 0
}
]
]
},
"Buttons": {
"main": [
[
{
"node": "Update bot status on GIVEAWAY RUN",
"type": "main",
"index": 0
}
]
]
},
"Commands": {
"main": [
[
{
"node": "List Channels",
"type": "main",
"index": 0
}
]
]
},
"Referal?": {
"main": [
[
{
"node": "Welcome message Referal",
"type": "main",
"index": 0
}
],
[
{
"node": "Welcome message Manager",
"type": "main",
"index": 0
}
]
]
},
"Telegram": {
"main": [
[
{
"node": "Union Statuses",
"type": "main",
"index": 0
}
]
]
},
"Add channel": {
"main": [
[
{
"node": "Request New Channel",
"type": "main",
"index": 0
}
],
[
{
"node": "Channel Exists",
"type": "main",
"index": 0
}
]
]
},
"Define flow": {
"main": [
[
{
"node": "Commands",
"type": "main",
"index": 0
}
],
[
{
"node": "Add channel",
"type": "main",
"index": 0
}
],
[
{
"node": "Define Step Giveaway",
"type": "main",
"index": 0
}
]
]
},
"Get Channels": {
"main": [
[
{
"node": "Telegram",
"type": "main",
"index": 0
}
]
]
},
"Variables TG": {
"main": [
[
{
"node": "Initialization",
"type": "main",
"index": 0
}
]
]
},
"Check Success": {
"main": [
[]
]
},
"List Channels": {
"main": [
[
{
"node": "Update bot status on GIVEAWAY REQUEST CHANNEL",
"type": "main",
"index": 0
}
]
]
},
"Check Success?": {
"main": [
[
{
"node": "Check Success",
"type": "main",
"index": 0
},
{
"node": "SMS for Winner",
"type": "main",
"index": 0
}
],
[
{
"node": "Check Failed",
"type": "main",
"index": 0
}
]
]
},
"Get Bot Status": {
"main": [
[
{
"node": "Define flow",
"type": "main",
"index": 0
}
]
]
},
"Initialization": {
"main": [
[
{
"node": "Start?",
"type": "main",
"index": 0
}
]
]
},
"SMS for Winner": {
"main": [
[
{
"node": "SMS for Manager",
"type": "main",
"index": 0
}
]
]
},
"Union Statuses": {
"main": [
[
{
"node": "Check Success?",
"type": "main",
"index": 0
}
]
]
},
"Delete Channels": {
"main": [
[]
]
},
"SMS for Manager": {
"main": [
[
{
"node": "Delete Channels",
"type": "main",
"index": 0
},
{
"node": "Delete Participants",
"type": "main",
"index": 0
},
{
"node": "Update bot status on START ",
"type": "main",
"index": 0
}
]
]
},
"Get Participants": {
"main": [
[
{
"node": "Random Participants",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Variables TG",
"type": "main",
"index": 0
}
]
]
},
"Delete Participants": {
"main": [
[]
]
},
"Random Participants": {
"main": [
[
{
"node": "Get Channels",
"type": "main",
"index": 0
}
]
]
},
"Define Step Giveaway": {
"main": [
[
{
"node": "List Channels",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Participants",
"type": "main",
"index": 0
}
]
]
},
"Welcome message Manager": {
"main": [
[
{
"node": "Upsert bot status on START",
"type": "main",
"index": 0
}
]
]
},
"Welcome message Referal": {
"main": [
[
{
"node": "Update bot status and referal",
"type": "main",
"index": 0
}
]
]
},
"Upsert bot status on START": {
"main": [
[]
]
},
"Add participant in Giveaway": {
"main": [
[]
]
},
"Update bot status on START ": {
"main": [
[
{
"node": "End Message",
"type": "main",
"index": 0
}
]
]
},
"Update bot status and referal": {
"main": [
[
{
"node": "Add participant in Giveaway",
"type": "main",
"index": 0
}
]
]
},
"Update bot status on GIVEAWAY RUN": {
"main": [
[
{
"node": "Create Giveaway",
"type": "main",
"index": 0
}
]
]
},
"Update bot status on GIVEAWAY REQUEST CHANNEL": {
"main": [
[]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow is ideal for businesses or individuals who want to run Telegram-based giveaways that require users to subscribe to certain channels in order to participate.
Source: https://n8n.io/workflows/3611/ — 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.
This template is ideal for users managing Telegram channels who want to automate the process of posting messages, including text and images, directly from an bot.
This template is for developers and automation specialists looking to create a Telegram bot that enables users to select items from a predefined list and save their choices to a Postgres database.
This workflow is for Telegram bot developers or marketers who want to verify user subscriptions to specific Telegram channels and optionally reward them with downloadable files.
Template was created in n8n v1.90.2 Chat Trigger node Telegram Trigger node Redis node Postgres node Execute Sub-workflow If node, Code node, Edit Fields (Set), Extract From File Community nodes: n8n-
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.