Workflow n8n

Automatisation Telegram avec n8n : transcription de messages vocaux

Ce workflow n8n permet d'automatiser la transcription de messages vocaux reçus sur Telegram en texte. Dans un contexte où la communication rapide et efficace est cruciale, ce processus est particulièrement utile pour les équipes qui souhaitent conserver une trace écrite des échanges vocaux. Par exemple, les entreprises peuvent utiliser ce système pour transformer des retours clients ou des notes de réunion en texte, facilitant ainsi le suivi et l'analyse des informations. Le workflow commence par un déclencheur Telegram qui capte les messages entrants. Ensuite, il utilise un nœud de décision pour déterminer si le message est vocal ou textuel. Si c'est un message vocal, le workflow récupère le fichier audio, puis le transcrit en texte grâce à l'intégration avec OpenAI. Les résultats sont ensuite préparés pour être utilisés par un agent IA qui peut analyser ou répondre aux messages. Enfin, le texte transcrit peut être enrichi avec des images générées par une requête HTTP, offrant ainsi une réponse visuelle et informative. Cette automatisation n8n permet non seulement de gagner du temps, mais aussi d'améliorer la qualité des interactions en rendant les informations plus accessibles et exploitables.

Tags clés :automatisationTelegramn8ntranscriptionintelligence artificielle
Catégorie: Webhook · Tags: automatisation, Telegram, n8n, transcription, intelligence artificielle0

Workflow n8n Telegram, transcription, intelligence artificielle : vue d'ensemble

Schéma des nœuds et connexions de ce workflow n8n, généré à partir du JSON n8n.

Workflow n8n Telegram, transcription, intelligence artificielle : détail des nœuds

  • Receive Telegram Messages

    Ce noeud reçoit les messages Telegram en tant que déclencheur du workflow.

  • Voice or Text?

    Ce noeud détermine si le message reçu est un texte ou un message vocal en fonction de règles définies.

  • Fetch Voice Message

    Ce noeud récupère le message vocal à partir de Telegram en utilisant l'identifiant du fichier.

  • Transcribe Voice to Text

    Ce noeud transcrit le message vocal en texte à l'aide de l'API OpenAI.

  • Prepare for LLM

    Ce noeud prépare les données pour le modèle de langage en les assignant à des options spécifiques.

  • Sticky Note2

    Ce noeud crée une note autocollante avec un contenu spécifié, une largeur et une hauteur données.

  • Sticky Note3

    Ce noeud crée une autre note autocollante avec des dimensions et un contenu définis.

  • AI Agent

    Ce noeud utilise un agent AI pour traiter le texte avec des options et un type de prompt spécifiés.

  • OpenAI Chat Model

    Ce noeud interroge le modèle de chat OpenAI avec des options définies.

  • SerpAPI

    Ce noeud utilise l'API SerpAPI pour effectuer des recherches basées sur des options fournies.

  • Structured Output Parser

    Ce noeud analyse la sortie structurée en utilisant un schéma JSON d'exemple.

  • Extract from File

    Ce noeud extrait des données d'un fichier selon les options et l'opération spécifiées.

  • Sticky Note

    Ce noeud crée une note autocollante avec des dimensions et un contenu définis.

  • Prepare Final Output

    Ce noeud prépare la sortie finale en assignant des options et des valeurs spécifiques.

  • Generate Image

    Ce noeud génère une image en effectuant une requête HTTP avec des paramètres spécifiés.

  • Sticky Note1

    Ce noeud crée une note autocollante avec un contenu, une largeur et une hauteur définies.

Inscris-toi pour voir l'intégralité du workflow

Inscription gratuite

S'inscrire gratuitementBesoin d'aide ?
{
  "meta": {
    "instanceId": "b41148c809c7896d124743d940fc0964703e540af66564ef95e25a4ceea61c77",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "070fd7b4-58ca-4372-a347-6f60f590e20b",
      "name": "Receive Telegram Messages",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        40,
        140
      ],
      "webhookId": "4e2cd560-ae4e-4ed7-a8ea-984518404e51",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "lff3pLERRdQmkmeV",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "0e0f3a32-fbde-42a9-aa7f-70fda7b05357",
      "name": "Voice or Text?",
      "type": "n8n-nodes-base.switch",
      "position": [
        400,
        220
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Audio",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "af30c479-4542-405f-b315-37c50c4e2bef",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.voice.file_id }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a3ca8cd4-fbb2-40b5-829a-24724f2fbc85",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.text || \"\" }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Error",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9bcfdee0-2f09-4037-a7b9-689ef392371d",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "error",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "b01dde88-bede-4500-974f-b2dc203ff841",
      "name": "Fetch Voice Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        760,
        120
      ],
      "webhookId": "23645237-4943-4c32-b18c-97c410cc3409",
      "parameters": {
        "fileId": "={{ $json.message.voice.file_id }}",
        "resource": "file"
      },
      "credentials": {
        "telegramApi": {
          "id": "lff3pLERRdQmkmeV",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fe91414e-3b10-482e-b8dd-d55266828dd7",
      "name": "Transcribe Voice to Text",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        980,
        120
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "translate"
      },
      "credentials": {
        "openAiApi": {
          "id": "uFPD9I4pWJ4xUVf7",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "74549458-fd4d-4824-a561-944f2f536b9b",
      "name": "Prepare for LLM",
      "type": "n8n-nodes-base.set",
      "position": [
        880,
        340
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b324a329-3c49-4f7f-b683-74331b7fe7f8",
              "name": "=text",
              "type": "string",
              "value": "={{$json.message.text}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "886246ad-7127-462a-a2b2-b4281f369d8b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        0
      ],
      "parameters": {
        "width": 260,
        "height": 320,
        "content": " \n**This workflow listens for incoming voice or text messages from Telegram users.** "
      },
      "typeVersion": 1
    },
    {
      "id": "d052bd49-dc23-4ec5-b153-a9eb305f0641",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        20
      ],
      "parameters": {
        "width": 460,
        "height": 260,
        "content": " **Voice messages are fetched from Telegram and transcribed into text using OpenAI's Whisper API.**  "
      },
      "typeVersion": 1
    },
    {
      "id": "156580f1-adf5-43ba-b54d-89b84ca87818",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1460,
        320
      ],
      "parameters": {
        "text": "={{$json.text}}",
        "options": {
          "systemMessage": " \n**1. AI Agent Goal Prompt (Overall Task)**\n\n*   **Purpose:** To define the agent's overall objective, removing the image creation step.\n\n```\nYou are an AI social media content creator. Your task is to research a given topic using SerpAPI, create engaging and SEO-optimized social media content (800-1000 characters), and generate a detailed image prompt. The content must be factually accurate and engaging. Prioritize factual accuracy and engaging storytelling in your content. The generated image prompt should be detailed and specific enough to be used with an image generation tool like DALL-E or Stable Diffusion.\n```\n\n**2. SerpAPI Tool Prompt (Research Phase)**\n\n*   **Purpose:** To instruct the agent on how to use SerpAPI to effectively gather information. (No change from previous version)\n\n```\nUse the SerpAPI tool to research the following topic: [TOPIC]. Focus on identifying key facts, trends, and interesting angles relevant for social media. Extract information from the top search results. Return a summary of the information you found focusing on key data and facts.\n```\n\n*   **Explanation:**\n    *   `[TOPIC]` is a variable that will be replaced with the specific topic.\n    *   Focuses the agent on extracting key facts and trends rather than just providing a list of results.\n    *   Limits the scope to the top search results to maintain efficiency.\n\n**3. Social Media Content Creation Prompt**\n\n*   **Purpose:** To guide the agent in creating engaging and SEO-friendly content based on the research. (No change from previous version)\n\n```\nBased on the following research summary: [RESEARCH_SUMMARY], create a social media post that is:\n\n*   Engaging and attention-grabbing\n*   Factually accurate\n*   Optimized for SEO (include relevant keywords naturally)\n*   Within 800-1000 characters\n*   Clearly and concisely written.\n*   Avoid jargon and technical terms.\n*    Include a call to action.\n\nThe tone should be informative but also enthusiastic and easily understandable.\n```\n\n*   **Explanation:**\n    *   `[RESEARCH_SUMMARY]` will be replaced with the output from the SerpAPI tool.\n    *   Specific instructions on tone, length, and SEO optimization.\n    *   Explicitly asks for clear and concise writing, avoiding jargon.\n    *   Added \"Include a call to action\" to make the content more actionable\n\n**4. Image Generation Prompt (for hypothetical image generation tool)**\n\n*   **Purpose:** To create a prompt that generates a detailed and descriptive image prompt for an image generation tool.  This prompt should now be the *final output* related to the image.\n\n```\nBased on the following topic: [TOPIC] and social media content: [SOCIAL_MEDIA_CONTENT], generate a detailed image prompt for a photorealistic image that visually represents the topic and complements the content. The image should be:\n\n*   Photorealistic and high-quality.\n*   Visually appealing and attention-grabbing.\n*   Relevant to the topic and content.\n*   Appropriate for social media.\n\nThe prompt should be exceptionally detailed and specific, providing precise instructions for an image generation tool like DALL-E or Stable Diffusion. Include details about the subject, setting, style, lighting, camera angles, and any other relevant visual elements.  Aim for a prompt that leaves no room for misinterpretation by the image generation AI.  Mention specific artists or photographic styles to emulate if appropriate.\n```\n\n*   **Explanation:**\n    *   `[TOPIC]` and `[SOCIAL_MEDIA_CONTENT]` are variables that will be replaced with the topic and the created social media content, respectively.\n    *   Focuses on *photorealism*, relevance, and visual appeal.\n    *   Emphasizes the need for an *exceptionally detailed and specific* prompt for the image generation tool.\n    *  Explicitly mentions DALL-E and Stable Diffusion as target tools.\n    *   Advises the inclusion of artist styles or photographic techniques to guide the image generation.\n\n**5. JSON Output Instruction**\n\n*   **Purpose:** To ensure the AI agent provides the output in the correct format.  The `image_url` field is replaced with `image_prompt`.\n\n```\nAfter generating the social media content and the image prompt, output the results in the following JSON format:\n\n```json\n{\n\"content\": \"[SOCIAL_MEDIA_CONTENT]\",\n\"image_prompt\": \"[IMAGE_PROMPT]\"\n}\n```\n\n`[SOCIAL_MEDIA_CONTENT]` is the social media content you created.\n`[IMAGE_PROMPT]` is the detailed image prompt you generated.\n```\n\n**Example Usage:**\n\nLet's say the topic is still \"The Benefits of Regular Exercise.\"\n\n1.  **SerpAPI Tool:** The agent uses SerpAPI to find information about the benefits of exercise.\n2.  **Social Media Content:** The agent generates content like: \"Boost your mood & health! 💪 Regular exercise reduces stress, improves sleep, and lowers disease risk. Get moving today! #exercise #healthylifestyle #fitness\"\n3.  **Image Prompt:** The agent generates an image prompt like: \"A photorealistic image of a diverse group of people happily participating in various forms of exercise in a vibrant outdoor setting. Some are jogging in a park with lush green trees, others are doing yoga poses on a grassy field, and a few are cycling on a paved path. The lighting is warm and golden, as if it's early morning or late afternoon. The style should be reminiscent of a National Geographic photograph, emphasizing the natural beauty of the scene and the healthy glow of the people. Use a shallow depth of field to blur the background slightly, drawing focus to the subjects. Camera angle: slightly low, capturing the energy and movement of the scene. Consider influences from the photographic style of Steve McCurry.\"\n4.  **JSON Output:**\n\n```json\n{\n\"content\": \"Boost your mood & health! 💪 Regular exercise reduces stress, improves sleep, and lowers disease risk. Get moving today! #exercise #healthylifestyle #fitness\",\n\"image_prompt\": \"A photorealistic image of a diverse group of people happily participating in various forms of exercise in a vibrant outdoor setting. Some are jogging in a park with lush green trees, others are doing yoga poses on a grassy field, and a few are cycling on a paved path. The lighting is warm and golden, as if it's early morning or late afternoon. The style should be reminiscent of a National Geographic photograph, emphasizing the natural beauty of the scene and the healthy glow of the people. Use a shallow depth of field to blur the background slightly, drawing focus to the subjects. Camera angle: slightly low, capturing the energy and movement of the scene. Consider influences from the photographic style of Steve McCurry.\"\n}\n```\n\n**Key Improvements and Techniques Used (Beyond the Previous Version):**\n\n*   **Focus on Photorealism:**  The image prompt now explicitly aims for photorealistic results.\n*   **Detailed Image Prompting:** The prompt emphasizes extreme detail and specificity in the image prompt.\n*   **Tool Agnostic:** The prompt mentions DALL-E and Stable Diffusion as example tools, but is designed to be usable with other image generation AIs.\n*   **Artist Style Guidance:** The prompt encourages the inclusion of artist or photographic style references.\n\n \n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "74f99543-d7e6-4d9b-8af1-9d86e0566ddc",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1460,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "uFPD9I4pWJ4xUVf7",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "62b9bb5f-0c87-4df4-ac1c-70b96a0a5cc4",
      "name": "SerpAPI",
      "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
      "position": [
        1580,
        560
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "serpApi": {
          "id": "AuYW6wcagKBXR214",
          "name": "SerpAPI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3782a100-3210-4c87-9e6a-5808cd488601",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1700,
        560
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\"content\": \"[SOCIAL_MEDIA_CONTENT]\",\n\"image_prompt\": \"[IMAGE_PROMPT]\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "87bf4b00-4f75-4098-993b-b4bd168339c2",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        2380,
        320
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "9a273f0b-bcb0-4ed8-93f5-6161d192e3ef",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1460,
        160
      ],
      "parameters": {
        "width": 280,
        "height": 140,
        "content": " **The AI agent uses the OpenAI Chat Model and SerpAPI tool to conduct research and generate social media content and an image prompt based on the user request.**"
      },
      "typeVersion": 1
    },
    {
      "id": "c907aa15-1ccf-475e-94da-3a81e54b3746",
      "name": "Prepare Final Output",
      "type": "n8n-nodes-base.set",
      "position": [
        2740,
        320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "df5eb034-ef40-44a3-a620-48981efd1a69",
              "name": "content",
              "type": "string",
              "value": "={{ $('AI Agent').item.json.output.content }}"
            },
            {
              "id": "9ed8afc9-a957-4aea-8554-8c67017ef0e6",
              "name": "image",
              "type": "string",
              "value": "={{ $json.data }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0893eac1-e72b-4a95-8c3c-4803aaaed9b9",
      "name": "Generate Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2020,
        320
      ],
      "parameters": {
        "url": "https://router.huggingface.co/hf-inference/models/stabilityai/stable-diffusion-3.5-large",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "inputs",
              "value": "={{ $json.output.image_prompt }}"
            }
          ]
        },
        "nodeCredentialType": "huggingFaceApi"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "ERi7DgDYlifAQg7i",
          "name": "Header Auth account"
        },
        "huggingFaceApi": {
          "id": "2koOz09ZdzCYUNif",
          "name": "HuggingFaceApi account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b99a090f-73de-4703-b569-8992df36132f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1960,
        240
      ],
      "parameters": {
        "width": 220,
        "height": 240,
        "content": " **An image is generated using the image prompt**  "
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "SerpAPI": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Generate Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Voice or Text?": {
      "main": [
        [
          {
            "node": "Fetch Voice Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare for LLM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare for LLM": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Prepare Final Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Voice Message": {
      "main": [
        [
          {
            "node": "Transcribe Voice to Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Final Output": {
      "main": [
        []
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe Voice to Text": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Telegram Messages": {
      "main": [
        [
          {
            "node": "Voice or Text?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Workflow n8n Telegram, transcription, intelligence artificielle : pour qui est ce workflow ?

Ce workflow s'adresse aux entreprises et équipes qui utilisent Telegram pour la communication, notamment dans les secteurs du service client, du marketing et de la gestion de projet. Un niveau technique intermédiaire est recommandé pour la mise en place et l'adaptation de ce workflow.

Workflow n8n Telegram, transcription, intelligence artificielle : problème résolu

Ce workflow résout le problème de la perte d'informations importantes contenues dans des messages vocaux sur Telegram. En automatisant la transcription, il élimine le besoin de prendre des notes manuellement, ce qui peut être chronophage et sujet à des erreurs. Les utilisateurs bénéficient d'une documentation écrite précise et rapide, facilitant ainsi le suivi des échanges et la prise de décisions éclairées.

Workflow n8n Telegram, transcription, intelligence artificielle : étapes du workflow

Étape 1 : Le workflow est déclenché par la réception de messages sur Telegram.

  • Étape 1 : Un nœud de décision détermine si le message est vocal ou textuel.
  • Étape 2 : Si le message est vocal, le fichier audio est récupéré.
  • Étape 3 : Le message vocal est ensuite transcrit en texte à l'aide d'OpenAI.
  • Étape 4 : Les résultats de la transcription sont préparés pour être traités par un agent IA.
  • Étape 5 : Le texte peut être enrichi avec des images générées via une requête HTTP.
  • Étape 6 : Le résultat final est préparé pour être utilisé ou partagé.

Workflow n8n Telegram, transcription, intelligence artificielle : guide de personnalisation

Pour personnaliser ce workflow, vous pouvez modifier l'URL du webhook pour l'adapter à votre instance Telegram. Vous pouvez également ajuster les paramètres de l'agent IA pour qu'il réponde de manière plus ciblée à vos besoins. Si vous souhaitez intégrer d'autres outils, envisagez d'ajouter des nœuds supplémentaires pour des services comme Google Sheets ou des plateformes CRM. Assurez-vous de sécuriser votre flux en configurant les autorisations d'accès appropriées et en surveillant les performances du workflow pour optimiser son efficacité.