{
  "name": "Trigger",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        -240,
        432
      ],
      "id": "a7cdceef-e28b-49a4-9036-e6d338db7ab1",
      "name": "Telegram Trigger",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "aadc69cc-8005-410e-a2a3-fbec0778265c",
              "name": "sessionId",
              "value": "={{ $json.message.chat.id.toString() }}",
              "type": "string"
            },
            {
              "id": "78e57aad-318c-4002-88ad-218d2ba808cf",
              "name": "from",
              "value": "={{ $json.message.from.first_name }} {{ $json.message.from.last_name }} ({{ $json.message.from.id }})",
              "type": "string"
            },
            {
              "id": "83db7957-87a4-4960-89ff-6d037b0f9cbb",
              "name": "query",
              "value": "={{ $json.message.text }}",
              "type": "string"
            },
            {
              "id": "33eea37c-f1a1-4963-b370-467b2f065b80",
              "name": "mode",
              "value": "text",
              "type": "string"
            },
            {
              "id": "f0f371ed-cbe5-45c4-b12a-5ca7b510fbf4",
              "name": "channel",
              "value": "telegram",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1008,
        448
      ],
      "id": "ab131250-525e-4cf0-96fd-ab6e3297193e",
      "name": "Edit Telegram Fields"
    },
    {
      "parameters": {
        "options": {
          "responseMode": "responseNodes"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        784,
        -96
      ],
      "id": "ce20af5b-b24a-4c5c-95ce-f6acf9a0bef6",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f2b8cb6e-0509-40e2-9260-63ee2f415eb7",
              "name": "app",
              "value": "chat",
              "type": "string"
            },
            {
              "id": "aadc69cc-8005-410e-a2a3-fbec0778265c",
              "name": "sessionId",
              "value": "={{ $json.sessionId }}",
              "type": "string"
            },
            {
              "id": "78e57aad-318c-4002-88ad-218d2ba808cf",
              "name": "from",
              "value": "n8n",
              "type": "string"
            },
            {
              "id": "83db7957-87a4-4960-89ff-6d037b0f9cbb",
              "name": "query",
              "value": "={{ $json.chatInput }}",
              "type": "string"
            },
            {
              "id": "3eb9e897-f48e-46fa-b3b4-68e23bfcbd72",
              "name": "channel",
              "value": "chat",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1008,
        -96
      ],
      "id": "674bd061-067b-44d7-9b15-4f2ce3d5fc28",
      "name": "Edit Chat Fields"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f2b8cb6e-0509-40e2-9260-63ee2f415eb7",
              "name": "app",
              "value": "slack",
              "type": "string"
            },
            {
              "id": "aadc69cc-8005-410e-a2a3-fbec0778265c",
              "name": "sessionId",
              "value": "={{ $json.channel }}",
              "type": "string"
            },
            {
              "id": "78e57aad-318c-4002-88ad-218d2ba808cf",
              "name": "from",
              "value": "={{ $json.user }}",
              "type": "string"
            },
            {
              "id": "83db7957-87a4-4960-89ff-6d037b0f9cbb",
              "name": "query",
              "value": "={{ $json.blocks[0].elements[0].elements[1].text }}",
              "type": "string"
            },
            {
              "id": "41252997-f667-41dc-a0bb-77369a189363",
              "name": "channel",
              "value": "slack",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1008,
        96
      ],
      "id": "70851cb2-f86a-4217-a674-b9da0d1b6c78",
      "name": "Edit Slack Fields"
    },
    {
      "parameters": {
        "trigger": [
          "any_event"
        ],
        "watchWorkspace": true,
        "options": {}
      },
      "type": "n8n-nodes-base.slackTrigger",
      "typeVersion": 1,
      "position": [
        784,
        96
      ],
      "id": "4497e901-5c37-47e1-aa51-02f5f895d76b",
      "name": "Slack Trigger1",
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "6a3d76a3-bce7-4c7e-9527-f3fd5d455762",
              "leftValue": "={{ $json.message.voice }}",
              "rightValue": "",
              "operator": {
                "type": "object",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        -80,
        432
      ],
      "id": "eaeeee31-7bee-4fec-93db-18ad4abbe024",
      "name": "If"
    },
    {
      "parameters": {
        "resource": "file",
        "fileId": "={{ $('Telegram Trigger').item.json.message.voice.file_id }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        160,
        272
      ],
      "id": "eed013b0-d1fa-45f0-a6b9-3a5fde633a62",
      "name": "Get a file",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "binaryToPropery",
        "destinationKey": "audioBase64",
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1.1,
      "position": [
        368,
        272
      ],
      "id": "246e80ac-1cfb-4446-9778-71d1229aab15",
      "name": "Extract from File"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://openrouter.ai/api/v1/chat/completions",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "openRouterApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"model\": \"{{ $json.model }}\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"input_audio\",\n          \"input_audio\": {\n            \"data\": \"{{ $json.audioBase64 }}\",\n            \"format\": \"ogg\"\n          }\n        },\n        {\n          \"type\": \"text\",\n          \"text\": \"Transcris exactement ce qui est dit dans cet audio, mot pour mot, sans ajouter de commentaire ni de r\u00e9ponse. Retourne uniquement la transcription brute en fran\u00e7ais.\"\n        }\n      ]\n    }\n  ]\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        784,
        272
      ],
      "id": "ef65a161-f98e-4e32-8f39-c6a42db8509f",
      "name": "Transcript Audio",
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "aadc69cc-8005-410e-a2a3-fbec0778265c",
              "name": "sessionId",
              "value": "={{ $('Telegram Trigger').item.json.message.chat.id.toString() }}",
              "type": "string"
            },
            {
              "id": "78e57aad-318c-4002-88ad-218d2ba808cf",
              "name": "from",
              "value": "={{ $('Telegram Trigger').item.json.message.from.first_name }} {{ $('Telegram Trigger').item.json.message.from.last_name }} ({{ $('Telegram Trigger').item.json.message.from.id }})",
              "type": "string"
            },
            {
              "id": "83db7957-87a4-4960-89ff-6d037b0f9cbb",
              "name": "query",
              "value": "={{ $json.choices[0].message.content }}",
              "type": "string"
            },
            {
              "id": "33eea37c-f1a1-4963-b370-467b2f065b80",
              "name": "mode",
              "value": "text",
              "type": "string"
            },
            {
              "id": "f0f371ed-cbe5-45c4-b12a-5ca7b510fbf4",
              "name": "channel",
              "value": "telegram",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1008,
        272
      ],
      "id": "66dc2e23-26d4-4b8c-bc13-b2ae948a49dd",
      "name": "Audio Telegram Fields"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "2d9b69c8-8708-44a6-8761-d6881552b50a",
              "name": "model",
              "value": "google/gemini-2.5-flash",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "include": "selected",
        "includeFields": "audioBase64",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        576,
        272
      ],
      "id": "4298093c-87f3-4823-b3cb-9af6e2d2cf8f",
      "name": "Edit Fields1"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "kURtwrSptYfKCRuG",
          "mode": "list",
          "cachedResultUrl": "/workflow/kURtwrSptYfKCRuG",
          "cachedResultName": "Manager"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "channel": "={{ $json.channel }}",
            "mode": "={{ $json.mode }}",
            "sessionId": "={{ $json.sessionId }}",
            "query": "={{ $json.query }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "channel",
              "displayName": "channel",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "mode",
              "displayName": "mode",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "sessionId",
              "displayName": "sessionId",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "query",
              "displayName": "query",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        1456,
        176
      ],
      "name": "Call Manager",
      "id": "98aba227-3e0c-4dcc-b2cc-030a91d2ebf6"
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Telegram Fields": {
      "main": [
        [
          {
            "node": "Call Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Edit Chat Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Chat Fields": {
      "main": [
        [
          {
            "node": "Call Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Slack Fields": {
      "main": [
        [
          {
            "node": "Call Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack Trigger1": {
      "main": [
        [
          {
            "node": "Edit Slack Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Get a file",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Telegram Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a file": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcript Audio": {
      "main": [
        [
          {
            "node": "Audio Telegram Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audio Telegram Fields": {
      "main": [
        [
          {
            "node": "Call Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Transcript Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false,
    "timeSavedMode": "fixed",
    "callerPolicy": "workflowsFromSameOwner",
    "executionTimeout": 1800,
    "errorWorkflow": "5V46L7csAX91UXTG"
  },
  "versionId": "6ee58781-23f9-4854-9a07-04f0d3ce28ed",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "um79LtvnjTgRZX5I",
  "tags": []
}