AutomationFlowsSlack & Telegram › Fundamentos If E Switch

Fundamentos If E Switch

Fundamentos IF e SWITCH. Uses telegram. Event-driven trigger; 15 nodes.

Event trigger★★★★☆ complexity15 nodesTelegram
Slack & Telegram Trigger: Event Nodes: 15 Complexity: ★★★★☆ Added:

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
{
  "updatedAt": "2025-06-15T14:57:46.149Z",
  "createdAt": "2025-06-15T14:57:46.149Z",
  "id": "AFWhYS1WRblr7mju",
  "name": "Fundamentos IF e SWITCH",
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "content": "# \u2696\ufe0f O que faz o IF Node?\n\n## O **IF node** avalia uma condi\u00e7\u00e3o.\n\n### - Se for **verdadeiro** \u2192 caminho \"true\"\n### - Se for **falso** \u2192 caminho \"false\"\n\n### Exemplo:  \n### idade > 18",
        "height": 880,
        "width": 720,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        340
      ],
      "id": "0e2bcfff-f2a3-46f1-8f83-5d9c9850065b",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "# Fluxo com IF\n\n## Verifica se a idade \u00e9 maior que 18.  \n## O fluxo segue por caminhos diferentes dependendo do resultado.\n\n## \u2705 Verdadeiro (true): segue o caminho de cima\n## \u274c Falso (false): segue o caminho de baixo",
        "height": 880,
        "width": 800,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        740,
        340
      ],
      "id": "552e221e-ce09-478c-a034-a18ad1212d6c",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "# \u2696\ufe0f\ud83d\udd04 Aula: Tomando Decis\u00f5es com IF e Switch\n\n## Nessa aula, voc\u00ea vai aprender a:\n\n### - Usar o **IF node** para decis\u00f5es simples (Ex: idade > 18)\n### - Usar o **Switch node** para m\u00faltiplas op\u00e7\u00f5es (Ex: escolha de departamento)\n### - Entender a diferen\u00e7a entre eles\n### - Exibir mensagens diferentes com base nos dados\n\n",
        "height": 320,
        "width": 1020,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "1a08af55-a019-4e9c-afff-345d51036489",
      "name": "Sticky Note2"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        40,
        880
      ],
      "id": "7329a0fb-d476-48d1-99c2-33c52932ec29",
      "name": "When clicking \u2018Test workflow\u2019"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6a435e1d-e79b-4081-bc5f-669570e4970a",
              "name": "nome",
              "value": "Z\u00e9 Ningu\u00e9m",
              "type": "string"
            },
            {
              "id": "d97d2623-6558-447a-b694-567f16a3c7c1",
              "name": "idade",
              "value": "25",
              "type": "string"
            },
            {
              "id": "340ba83a-bff4-4bf0-bf5e-c21c64f3deb0",
              "name": "cidade",
              "value": "Rio de Janeiro",
              "type": "string"
            },
            {
              "id": "c495a311-bb71-4be1-a0d4-132dc45a95f8",
              "name": "intencao",
              "value": "suporte",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "676aeeaa-bc03-45a5-9db1-934ef3701630",
      "name": "Set - Dados do usu\u00e1rio",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        300,
        880
      ]
    },
    {
      "parameters": {
        "content": "# \ud83d\udd04 O que faz o Switch Node?\n\n## Usado para **m\u00faltiplas decis\u00f5es** com base em um valor.\n\n## Exemplo:  \n## Usu\u00e1rio escolhe: \"vendas\", \"suporte\", ou \"financeiro\"\n\n## Cada valor leva o fluxo por um caminho diferente.\n",
        "height": 900,
        "width": 1140,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1560,
        340
      ],
      "id": "b242a663-33cc-465a-86ac-f86a3f66059f",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "content": "# \ud83d\ude80 Desafio:\n\n## 1. Mude a idade inicial para **21** \u2192 o IF deve ir para \"adulto\"\n## 2. Depois mude para **16** \u2192 vai para \"menor\"\n## 3. No campo `intencao`, teste com \"RH\"\n## 4. Adicione uma **sa\u00edda default** no Switch com a mensagem:\n##   > \"\u00c1rea n\u00e3o reconhecida, tente novamente.\"\n\n## \ud83d\udc4f Pronto! Agora voc\u00ea sabe controlar o fluxo com l\u00f3gica no n8n!\n",
        "height": 460,
        "width": 800,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2720,
        340
      ],
      "id": "227e6fdd-afa9-49b1-88e9-a812b1606fd3",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "a635b2b0-f5da-4dca-bad8-b296b9b94200",
              "leftValue": "={{ $json.idade }}",
              "rightValue": 18,
              "operator": {
                "type": "number",
                "operation": "gt"
              }
            },
            {
              "id": "f135dbaf-dafb-4646-bfec-ecb08dbb4ee5",
              "leftValue": "={{ $json.idade }}",
              "rightValue": 30,
              "operator": {
                "type": "number",
                "operation": "lt"
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        540,
        880
      ],
      "id": "37d4fb58-396b-4b8b-9139-251a565f3327",
      "name": "Maior de Idade?"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "eb00d6b8-fcb2-41bb-b5aa-79f97f188e5d",
              "name": "mensagem",
              "value": "Maior de idade: pode acessar o conte\u00fado.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1080,
        780
      ],
      "id": "baf0b400-0481-49a2-a9fe-09c9541919bc",
      "name": "Set - Mensagem: Adulto"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "dba623f2-e120-4946-98d4-d7beefecc50d",
              "name": "mensagem",
              "value": "Menor de idade: acesso restrito.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1080,
        1020
      ],
      "id": "4bcf1678-a39b-482f-82a5-4f54550496ef",
      "name": "Set - Mensagem: Menor de idade"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "f6a18fe3-0533-45f6-8aab-ae3337eeebcc",
                    "leftValue": "={{ $('Maior de Idade?').item.json.intencao }}",
                    "rightValue": "vendas",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "vendas"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "69593be0-8225-406f-ba7c-1d72a5287b83",
                    "leftValue": "={{ $('Maior de Idade?').item.json.intencao }}",
                    "rightValue": "suporte",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "suporte"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "9373d69b-319d-4b5a-843d-7bfb01e3d4a0",
                    "leftValue": "={{ $('Maior de Idade?').item.json.intencao }}",
                    "rightValue": "financeiro",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "financeiro"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        1720,
        880
      ],
      "id": "8eea8657-da96-4e35-b640-1b7f590e6efb",
      "name": "Switch - Escolher departamento"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "eb00d6b8-fcb2-41bb-b5aa-79f97f188e5d",
              "name": "mensagem",
              "value": "Nosso time de vendas vai falar com voc\u00ea.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2080,
        700
      ],
      "id": "43bbe3a9-0265-4fe0-b924-2251adc20dda",
      "name": "Set - Mensagem: Vendas"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "eb00d6b8-fcb2-41bb-b5aa-79f97f188e5d",
              "name": "mensagem",
              "value": "Voc\u00ea ser\u00e1 atendido pelo suporte t\u00e9cnico.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2080,
        880
      ],
      "id": "8b2fae10-3dae-45a9-88fa-63b39ad8423e",
      "name": "Set - Mensagem: Suporte"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "eb00d6b8-fcb2-41bb-b5aa-79f97f188e5d",
              "name": "mensagem",
              "value": "Encaminharemos sua solicita\u00e7\u00e3o ao financeiro.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2080,
        1060
      ],
      "id": "baf55ad0-1eb2-4629-a51f-2689cbd2ed86",
      "name": "Set - Mensagem: Financeiro"
    },
    {
      "parameters": {
        "chatId": "1111",
        "text": "={{ $json.mensagem }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        2460,
        880
      ],
      "id": "986d08c3-f58b-4144-83f4-198cc12b9b37",
      "name": "Telegram"
    }
  ],
  "connections": {
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Set - Dados do usu\u00e1rio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set - Dados do usu\u00e1rio": {
      "main": [
        [
          {
            "node": "Maior de Idade?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Maior de Idade?": {
      "main": [
        [
          {
            "node": "Set - Mensagem: Adulto",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set - Mensagem: Menor de idade",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set - Mensagem: Adulto": {
      "main": [
        [
          {
            "node": "Switch - Escolher departamento",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set - Mensagem: Menor de idade": {
      "main": [
        [
          {
            "node": "Switch - Escolher departamento",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch - Escolher departamento": {
      "main": [
        [
          {
            "node": "Set - Mensagem: Vendas",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set - Mensagem: Suporte",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set - Mensagem: Financeiro",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set - Mensagem: Suporte": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set - Mensagem: Vendas": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set - Mensagem: Financeiro": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": null,
  "versionId": "e9465655-1fe2-405b-a7cd-4d13f7efea45",
  "activeVersionId": null,
  "triggerCount": 0,
  "shared": [
    {
      "updatedAt": "2025-06-15T14:57:46.149Z",
      "createdAt": "2025-06-15T14:57:46.149Z",
      "role": "workflow:owner",
      "workflowId": "AFWhYS1WRblr7mju",
      "projectId": "o60HadikmqrvYZ9Z"
    }
  ],
  "activeVersion": null,
  "tags": [
    {
      "updatedAt": "2025-06-14T14:35:30.743Z",
      "createdAt": "2025-06-14T14:35:30.743Z",
      "id": "f7Ttu7FQN3EvRKX9",
      "name": "\ud83e\udd77\ud83c\udffc Ninja Automa\u00e7\u00f5es"
    }
  ]
}
Pro

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

About this workflow

Fundamentos IF e SWITCH. Uses telegram. Event-driven trigger; 15 nodes.

Source: https://github.com/diegohugo570/backup-n8n/blob/4b35f5dcf0af947eeb77275d3dcc3f4ff1d296b7/workflows/Fundamentos_IF_e_SWITCH.json — 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

N8N Complete Final. Uses telegramTrigger, dataTable, telegram, mqtt. Event-driven trigger; 58 nodes.

Telegram Trigger, Data Table, Telegram +3
Slack & Telegram

Pede Ai. Uses httpRequest, telegram, postgres, telegramTrigger. Event-driven trigger; 57 nodes.

HTTP Request, Telegram, Postgres +1
Slack & Telegram

TextMain. Uses telegramTrigger, stopAndError, telegram, httpRequest. Event-driven trigger; 56 nodes.

Telegram Trigger, Stop And Error, Telegram +2
Slack & Telegram

Pede Ai. Uses httpRequest, telegram, postgres, telegramTrigger. Event-driven trigger; 53 nodes.

HTTP Request, Telegram, Postgres +1
Slack & Telegram

03 - Command Handler. Uses executeWorkflowTrigger, telegram, executeCommand, postgres. Event-driven trigger; 53 nodes.

Execute Workflow Trigger, Telegram, Execute Command +2