← All N8N workflows
Messaging & emailFilterN8NSwitchTelegram Trigger

Switch depending on content

Configured with Filter, N8N, Switch, Telegram Trigger. Review the connections and setup before adapting this template.

Workflow preview
RoutingKeep only messages froma specific chat idFilterIntegrationDeactivate themarketing workflowN8NIntegrationDeactivate the salesworkflowN8NIntegrationActivate the marketingworkflowN8NRoutingSwitch depending oncontent (activate)SwitchTriggerReceive commands fromTelegramTelegram TriggerIntegrationActivate the salesworkflowN8NRoutingSwitch depending oncommandSwitchRoutingSwitch depending oncontent (deactivate)Switch

Node categories in this workflow

  • Routing
  • Integration
  • Trigger

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
Keep only messages from a specific chat idRoutingFilterSee node parameters
Deactivate the marketing workflowIntegrationN8Ndeactivate
Deactivate the sales workflowIntegrationN8Ndeactivate
Activate the marketing workflowIntegrationN8Nactivate
Switch depending on content (activate)RoutingSwitchSee node parameters
Receive commands from TelegramTriggerTelegram TriggerSee node parameters
Activate the sales workflowIntegrationN8Nactivate
Switch depending on commandRoutingSwitchSee node parameters
Switch depending on content (deactivate)RoutingSwitchSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • n8nApi
  • telegramApi

Workflow notes

Switch depending on content

Switch depending on content

0 = if command contains the word "marketing" 1 = if command contains the word "sales"

Switch depending on command

Switch depending on command

0 = /stop 1 = /start

Telegram N8N workflow (de)activator

Telegram N8N workflow (de)activator

What does it do?

This workflow helps you to quickly activate or deactivate a workflow through Telegram. Sometimes we are not able to access a PC to resolve an issue if something goes wrong with a workflow. If you, like me, use Telegram to send yourself error reports, you can quickly react in case of urgency. Just by sending '/stop' combined with the name you use for a workflow, you can deactivate a workflow, or reactivate it with '/start'. For example '/stop marketing'.

Walkthrough: https://watch.screencastify.com/v/uWQ88gZKj57WTGOOqSW2 (6min)

Instructions

  1. Create a Telegram API key through botfather (https://t.me/botfather). Add it to the telegram credentials.
  2. For the N8N nodes, go to settings in your n8n instance. Then 'n8n API' and 'create an API key'.
  3. To ensure that only we can send commands to the bot, we need the chat ID of our DM with our newly created bot. Open the the Telegram trigger and click on 'listen to events'.
  4. Go to Telegram and send a direct message to the bot, this will trigger the Telegram node.
  5. Go to the filter node and fill in the chat id you want to filter for with the data you got from the test event in the Telegram node.
  6. In the first Switch node you can find the commands, in this case it is '/start' and '/stop'. When you send a message to your bot starting with either of those, it will go to the next switch nodes.
  7. Next it will check what other word it contains. As an example I have used the words 'marketing' and 'sales', both corresponding to a marketing and sales workflow.
  8. The last nodes will either activate or deactivate a workflow.
Switch depending on content

Switch depending on content

Purpose and structure

This folder contains the Switch depending on content workflow. Its executable nodes use filter, n8n, switch, telegramTrigger. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

Receive commands from Telegram

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Filter/0335_Filter_Telegram_Send_Triggered.json MIT; preserve source notices.

More in Messaging & email