{
  "name": "Notify",
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": true
  },
  "nodes": [
    {
      "id": "ntf-wh",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        0
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "notify",
        "responseMode": "lastNode",
        "options": {}
      }
    },
    {
      "id": "ntf-switch",
      "name": "Router",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        220,
        0
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict"
                },
                "conditions": [
                  {
                    "id": "cond-tg",
                    "leftValue": "={{ $json.body.channel }}",
                    "rightValue": "telegram",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "telegram"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict"
                },
                "conditions": [
                  {
                    "id": "cond-wa",
                    "leftValue": "={{ $json.body.channel }}",
                    "rightValue": "whatsapp",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "whatsapp"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict"
                },
                "conditions": [
                  {
                    "id": "cond-sms",
                    "leftValue": "={{ $json.body.channel }}",
                    "rightValue": "sms",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "sms"
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      }
    },
    {
      "id": "ntf-tg",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        500,
        -200
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "parameters": {
        "resource": "message",
        "operation": "sendMessage",
        "chatId": "={{ $json.body.recipient }}",
        "text": "={{ $json.body.text }}",
        "additionalFields": {
          "parse_mode": "Markdown",
          "appendAttribution": false
        }
      }
    },
    {
      "id": "ntf-wa",
      "name": "WhatsApp",
      "type": "n8n-nodes-base.twilio",
      "typeVersion": 1,
      "position": [
        500,
        -60
      ],
      "credentials": {
        "twilioApi": {
          "name": "<your credential>"
        }
      },
      "parameters": {
        "resource": "sms",
        "operation": "send",
        "from": "={{ ($json.body.from || '').replace('whatsapp:', '') }}",
        "to": "={{ ($json.body.recipient || '').replace('whatsapp:', '') }}",
        "toWhatsapp": true,
        "message": "={{ $json.body.text }}"
      }
    },
    {
      "id": "ntf-sms",
      "name": "SMS",
      "type": "n8n-nodes-base.twilio",
      "typeVersion": 1,
      "position": [
        500,
        80
      ],
      "credentials": {
        "twilioApi": {
          "name": "<your credential>"
        }
      },
      "parameters": {
        "resource": "sms",
        "operation": "send",
        "from": "={{ $json.body.from || '' }}",
        "to": "={{ $json.body.recipient }}",
        "toWhatsapp": false,
        "message": "={{ $json.body.text }}"
      }
    },
    {
      "id": "ntf-fallback",
      "name": "Unknown",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        500,
        220
      ],
      "parameters": {
        "jsCode": "return [{ json: { success: false, error: 'Unknown channel: ' + ($json.body?.channel || 'none') } }];"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Router": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "WhatsApp",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "SMS",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Unknown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}