AutomationFlowsSlack & Telegram › Telegram Bot for Item Multi Select and Saving to Postgres (module "checkbox")

Telegram Bot for Item Multi Select and Saving to Postgres (module "checkbox")

ByAndrew @boanse on n8n.io

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.

Event trigger★★★★★ complexity46 nodesTelegramPostgresTelegram Trigger
Slack & Telegram Trigger: Event Nodes: 46 Complexity: ★★★★★ Added:

This workflow corresponds to n8n.io template #3648 — 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 →

Download .json
{
  "id": "KCGTmRn3lbzfx0on",
  "name": "TG-Bot-Module-Checkbox-v2-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": "d065e9ae-ea26-4b2f-aafc-875149b65b5a",
      "name": "Send",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2520,
        -40
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "28672168-5a49-41e9-86c9-a322f366576c",
      "name": "Update message_id",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2740,
        -40
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "4f788243-df38-4943-90f3-f50385ba7269",
      "name": "Get message_id",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1200,
        -240
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "96fa1b44-9ab6-46ab-9f31-ae3f4ca91a9b",
      "name": "Get Shop List",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1200,
        -40
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "ea0ad58d-0e28-4417-aaaf-3a0f2e2cd05d",
      "name": "Add Shop List Choice",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1420,
        -40
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "6918085c-28de-4872-8d7d-955e0502e1c5",
      "name": "Get Shop List Choice",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1640,
        -240
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "6d59a9e0-4953-4843-9a87-acafd7490d39",
      "name": "Update Shop List Choice",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1420,
        -240
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "3db18d31-9302-45ab-8e8c-00f475aab9bb",
      "name": "Edit",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2520,
        -240
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "6ef72b01-1b87-4003-aa39-db1155691915",
      "name": "Convert statuses",
      "type": "n8n-nodes-base.code",
      "position": [
        1640,
        -40
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "2212a148-3d32-4be6-a989-0fc482ede8f8",
      "name": "Convert statuses and antistatuses",
      "type": "n8n-nodes-base.code",
      "position": [
        1860,
        -240
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "dd58465e-693c-4628-886a-f51a7e62a38e",
      "name": "Variables TG",
      "type": "n8n-nodes-base.set",
      "position": [
        -140,
        -40
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "301a05b3-f0a8-40fe-b2db-2ff015455556",
      "name": "Initialization",
      "type": "n8n-nodes-base.set",
      "position": [
        100,
        -40
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "7f9e5365-d2db-4925-a638-13f17ddc3183",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -360,
        -40
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "cc09ce10-2c8c-4140-a3f3-b4930e781b10",
      "name": "Welcome Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        320,
        -240
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "37146263-537c-462f-a5ea-b4fb246974af",
      "name": "Start?",
      "type": "n8n-nodes-base.if",
      "position": [
        320,
        -40
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "1dedc192-55f9-4007-b2c4-c524c5d31ab9",
      "name": "Define Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        540,
        -40
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "136abdb4-146b-45c5-beed-964a21882f12",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        760,
        -240
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "7eb8a6f0-e17c-443b-b9c2-003c997b9721",
      "name": "Results",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2520,
        -440
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "341fa44b-e82e-454a-919f-b2e893cb3fdf",
      "name": "Get Shop List Choices",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1200,
        -440
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "9a3e8667-05b6-43cd-b622-c846fc290b5e",
      "name": "New?",
      "type": "n8n-nodes-base.if",
      "position": [
        760,
        -40
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "b182148c-cd63-4907-b06b-0d857fe217bd",
      "name": "Add Order",
      "type": "n8n-nodes-base.postgres",
      "position": [
        980,
        -40
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "e3d21c9a-92da-4157-84ca-d639d0c3b0f4",
      "name": "Get Order",
      "type": "n8n-nodes-base.postgres",
      "position": [
        980,
        -240
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "9efb1e5f-3471-4beb-9574-cd3cf5423d08",
      "name": "Get Order ",
      "type": "n8n-nodes-base.postgres",
      "position": [
        980,
        -440
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "9e45cadf-99ca-4ac7-b4ac-24583e1ae577",
      "name": "Union Number with Text",
      "type": "n8n-nodes-base.set",
      "position": [
        1640,
        -440
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "74908820-0030-46f9-93c4-03409d1114c6",
      "name": "Union List",
      "type": "n8n-nodes-base.summarize",
      "position": [
        1860,
        -440
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "f0735435-b9e0-440f-99d9-d2103beced70",
      "name": "Active?",
      "type": "n8n-nodes-base.if",
      "position": [
        1420,
        -440
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "1a1662fd-9132-492c-820c-73eb053bc82b",
      "name": "Success",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2520,
        -1040
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "3f98deb7-91b9-45bd-9793-46aee0d27646",
      "name": "Answers",
      "type": "n8n-nodes-base.switch",
      "position": [
        980,
        -640
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "7e34ab31-d876-4e57-af2a-0ca16f676496",
      "name": "Get Shop List Choices ",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1420,
        -640
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "c1c90687-59d3-45a5-9120-4f5cbc665716",
      "name": "Get Order  ",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1200,
        -640
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "0b7fe215-da59-4929-9ff0-243f228ca44a",
      "name": "Update message_id ",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2740,
        -640
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "651bbf00-0f3c-4f62-90b5-495620d0f31b",
      "name": "Send ",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2520,
        -640
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "d16ecf8d-8710-4670-b075-665868b12448",
      "name": "Convert statuses ",
      "type": "n8n-nodes-base.code",
      "position": [
        1640,
        -640
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "b32aa3a1-7c77-449f-97a3-e6a16ad75eb8",
      "name": "Upsert bot status on START",
      "type": "n8n-nodes-base.postgres",
      "position": [
        540,
        -240
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "82b8d8e1-e85e-4b05-8dce-837e7803952b",
      "name": "Update message_id  ",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2740,
        -240
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "c6df2a06-9190-4147-92d3-3c1c66ee7c4e",
      "name": "Get message_id ",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2080,
        -440
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "7426d596-c35f-4fca-97a4-c8b5baa756b2",
      "name": "Delete Prev SMS",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2300,
        -440
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "78621baf-bfcc-46aa-b60d-9cff4f510af7",
      "name": "Update message_id   ",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2740,
        -440
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "73aff6d6-69c8-4ab4-a7ca-49fc389855e3",
      "name": "Get message_id  ",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1420,
        -840
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "59332e3f-4f81-41a4-972c-68e0b9c56e82",
      "name": "Delete Prev SMS ",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1640,
        -840
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "873cf289-950a-4a7f-94bb-a91270d32a69",
      "name": "Get message_id   ",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2740,
        -1040
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "ef673238-88cc-436d-a0c9-8a8fbabc3e97",
      "name": "Delete Prev SMS  ",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2960,
        -1040
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "99de2f14-e365-4d25-843c-46ce2e38b691",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -820,
        -320
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "0ca089e8-f540-4d18-8fea-cd49d503edd9",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -820,
        -40
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "62f94e29-3299-4dce-8340-9b73607acfd3",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -820,
        280
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "cafd4316-13cb-4bed-82f1-3217f40bdcf2",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        280
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4f299886-d7f2-4fde-93eb-0c769aa52ead",
  "connections": {
    "Edit": {
      "main": [
        [
          {
            "node": "Update message_id  ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New?": {
      "main": [
        [
          {
            "node": "Add Order",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Send": {
      "main": [
        [
          {
            "node": "Update message_id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send ": {
      "main": [
        [
          {
            "node": "Update message_id ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start?": {
      "main": [
        [
          {
            "node": "Welcome Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Define Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Answers",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Order ",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Active?": {
      "main": [
        [
          {
            "node": "Union Number with Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Answers": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Order  ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Results": {
      "main": [
        [
          {
            "node": "Update message_id   ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Success": {
      "main": [
        [
          {
            "node": "Get message_id   ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Order": {
      "main": [
        [
          {
            "node": "Get Shop List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Order": {
      "main": [
        [
          {
            "node": "Get message_id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Order ": {
      "main": [
        [
          {
            "node": "Get Shop List Choices",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Union List": {
      "main": [
        [
          {
            "node": "Get message_id ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define Type": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "New?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Order  ": {
      "main": [
        [
          {
            "node": "Get Shop List Choices ",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get message_id  ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Variables TG": {
      "main": [
        [
          {
            "node": "Initialization",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Shop List": {
      "main": [
        [
          {
            "node": "Add Shop List Choice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get message_id": {
      "main": [
        [
          {
            "node": "Update Shop List Choice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initialization": {
      "main": [
        [
          {
            "node": "Start?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Prev SMS": {
      "main": [
        [
          {
            "node": "Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get message_id ": {
      "main": [
        [
          {
            "node": "Delete Prev SMS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Welcome Message": {
      "main": [
        [
          {
            "node": "Upsert bot status on START",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert statuses": {
      "main": [
        [
          {
            "node": "Send",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Prev SMS ": {
      "main": [
        []
      ]
    },
    "Get message_id  ": {
      "main": [
        [
          {
            "node": "Delete Prev SMS ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Variables TG",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert statuses ": {
      "main": [
        [
          {
            "node": "Send ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get message_id   ": {
      "main": [
        [
          {
            "node": "Delete Prev SMS  ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Shop List Choice": {
      "main": [
        [
          {
            "node": "Convert statuses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Shop List Choice": {
      "main": [
        [
          {
            "node": "Convert statuses and antistatuses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Shop List Choices": {
      "main": [
        [
          {
            "node": "Active?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Shop List Choices ": {
      "main": [
        [
          {
            "node": "Convert statuses ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Union Number with Text": {
      "main": [
        [
          {
            "node": "Union List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Shop List Choice": {
      "main": [
        [
          {
            "node": "Get Shop List Choice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert statuses and antistatuses": {
      "main": [
        [
          {
            "node": "Edit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

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.

Source: https://n8n.io/workflows/3648/ — original creator credit. Request a take-down →

More Slack & Telegram workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Slack & Telegram

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.

Telegram Trigger, Postgres, Telegram
Slack & Telegram

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.

Telegram, Postgres, Google Drive +1
Slack & Telegram

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.

Telegram, Postgres, Telegram Trigger
Slack & Telegram

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-

Telegram Trigger, Chat Trigger, Telegram +3
Slack & Telegram

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Telegram Trigger, n8n, Telegram +4