Back to Integrations
integrationOpenAI node
integrationTelegram node

OpenAI and Telegram integration

Save yourself the work of writing custom integrations for OpenAI and Telegram and use n8n instead. Build adaptable and scalable AI, Langchain, and Communication workflows that work with your technology stack. All within a building experience you will love.

How to connect OpenAI and Telegram

  • Step 1: Create a new workflow
  • Step 2: Add and configure nodes
  • Step 3: Connect
  • Step 4: Customize and extend your integration
  • Step 5: Test and activate your workflow

Step 1: Create a new workflow and add the first step

In n8n, click the "Add workflow" button in the Workflows tab to create a new workflow. Add the starting point – a trigger on when your workflow should run: an app event, a schedule, a webhook call, another workflow, an AI chat, or a manual trigger. Sometimes, the HTTP Request node might already serve as your starting point.

OpenAI and Telegram integration: Create a new workflow and add the first step

Step 2: Add and configure OpenAI and Telegram nodes

You can find OpenAI and Telegram in the nodes panel. Drag them onto your workflow canvas, selecting their actions. Click each node, choose a credential, and authenticate to grant n8n access. Configure OpenAI and Telegram nodes one by one: input data on the left, parameters in the middle, and output data on the right.

OpenAI and Telegram integration: Add and configure OpenAI and Telegram nodes

Step 3: Connect OpenAI and Telegram

A connection establishes a link between OpenAI and Telegram (or vice versa) to route data through the workflow. Data flows from the output of one node to the input of another. You can have single or multiple connections for each node.

OpenAI and Telegram integration: Connect OpenAI and Telegram

Step 4: Customize and extend your OpenAI and Telegram integration

Use n8n's core nodes such as If, Split Out, Merge, and others to transform and manipulate data. Write custom JavaScript or Python in the Code node and run it as a step in your workflow. Connect OpenAI and Telegram with any of n8n’s 1000+ integrations, and incorporate advanced AI logic into your workflows.

OpenAI and Telegram integration: Customize and extend your OpenAI and Telegram integration

Step 5: Test and activate your OpenAI and Telegram workflow

Save and run the workflow to see if everything works as expected. Based on your configuration, data should flow from OpenAI to Telegram or vice versa. Easily debug your workflow: you can check past executions to isolate and fix the mistake. Once you've tested everything, make sure to save your workflow and activate it.

OpenAI and Telegram integration: Test and activate your OpenAI and Telegram workflow

Automated AI image analysis and response via Telegram

Example: @SubAlertMe_Bot

Summary:

The automated image analysis and response workflow using n8n is a sophisticated solution designed to streamline the process of analyzing images sent via Telegram and delivering insightful responses based on the analysis outcomes. This cutting-edge workflow employs a series of meticulously orchestrated nodes to ensure seamless automation and efficiency in image processing tasks.

Use Cases:

This advanced workflow caters to a myriad of scenarios where real-time image analysis and response mechanisms are paramount. The use cases include:

  • Providing immediate feedback on images shared within Telegram groups.
  • Enabling automated content moderation based on the analysis of image content.
  • Facilitating rapid categorization and tagging of images based on the results of the analysis.

Detailed Workflow Setup:

To effectively implement this workflow, users must adhere to a meticulous setup process, which includes:

  • Access to the versatile n8n platform, ensuring seamless workflow orchestration.
  • Integration of a Telegram account to facilitate image reception and communication.
  • Utilization of an OpenAI account for sophisticated image analysis capabilities.
  • Configuration of Telegram and OpenAI credentials within the n8n environment for seamless integration.
  • Proficiency in creating and interconnecting nodes within the n8n workflow for optimal functionality.

Detailed Node Description:

  1. Get the Image (Telegram Trigger):

    • Actively triggers upon receipt of an image via Telegram, ensuring prompt processing.
    • Extracts essential information from the received image message to initiate further actions.
  2. Merge all fields To get data from trigger:

    • Seamlessly amalgamates all relevant data fields extracted from the trigger node for comprehensive data consolidation.
  3. Analyze Image (OpenAI):

    • Harnesses the powerful capabilities of OpenAI services to conduct in-depth analysis of the received image.
    • Processes the image data in base64 format to derive meaningful insights from the visual content.
  4. Aggregate all fields:

    • Compiles and consolidates all data items for subsequent processing and analysis, ensuring comprehensive data aggregation.
  5. Send Content for the Analyzed Image (Telegram):

    • Transmits the analyzed content back to the Telegram chat interface for seamless communication.
    • Delivers the analyzed information in textual format, enhancing user understanding and interaction.
  6. Switch Node:

    • The Switch node is pivotal for decision-making based on predefined conditions within the workflow.
    • It evaluates incoming data to determine the existence or absence of specific elements, such as images in this context.
    • Utilizes a set of rules to assess the presence of image data in the message payload and distinguishes between cases where images are detected and when they are not.
    • This crucial node plays a pivotal role in directing the flow of the workflow based on the outcomes of its evaluations.

Conclusion:

The automation of image analysis processes through this sophisticated workflow not only enhances operational efficiency but also revolutionizes communication dynamics within Telegram interactions. By incorporating this advanced workflow solution, users can optimize their image analysis workflows, bolster communication efficacy, and unlock new levels of automation in image processing tasks.

Nodes used in this workflow

Popular OpenAI and Telegram workflows

Telegram Trigger node
Merge node
Aggregate node
Telegram node
+3

Automated AI image analysis and response via Telegram

Example: @SubAlertMe_Bot Summary: The automated image analysis and response workflow using n8n is a sophisticated solution designed to streamline the process of analyzing images sent via Telegram and delivering insightful responses based on the analysis outcomes. This cutting-edge workflow employs a series of meticulously orchestrated nodes to ensure seamless automation and efficiency in image processing tasks. Use Cases: This advanced workflow caters to a myriad of scenarios where real-time image analysis and response mechanisms are paramount. The use cases include: Providing immediate feedback on images shared within Telegram groups. Enabling automated content moderation based on the analysis of image content. Facilitating rapid categorization and tagging of images based on the results of the analysis. Detailed Workflow Setup: To effectively implement this workflow, users must adhere to a meticulous setup process, which includes: Access to the versatile n8n platform, ensuring seamless workflow orchestration. Integration of a Telegram account to facilitate image reception and communication. Utilization of an OpenAI account for sophisticated image analysis capabilities. Configuration of Telegram and OpenAI credentials within the n8n environment for seamless integration. Proficiency in creating and interconnecting nodes within the n8n workflow for optimal functionality. Detailed Node Description: Get the Image (Telegram Trigger): Actively triggers upon receipt of an image via Telegram, ensuring prompt processing. Extracts essential information from the received image message to initiate further actions. Merge all fields To get data from trigger: Seamlessly amalgamates all relevant data fields extracted from the trigger node for comprehensive data consolidation. Analyze Image (OpenAI): Harnesses the powerful capabilities of OpenAI services to conduct in-depth analysis of the received image. Processes the image data in base64 format to derive meaningful insights from the visual content. Aggregate all fields: Compiles and consolidates all data items for subsequent processing and analysis, ensuring comprehensive data aggregation. Send Content for the Analyzed Image (Telegram): Transmits the analyzed content back to the Telegram chat interface for seamless communication. Delivers the analyzed information in textual format, enhancing user understanding and interaction. Switch Node: The Switch node is pivotal for decision-making based on predefined conditions within the workflow. It evaluates incoming data to determine the existence or absence of specific elements, such as images in this context. Utilizes a set of rules to assess the presence of image data in the message payload and distinguishes between cases where images are detected and when they are not. This crucial node plays a pivotal role in directing the flow of the workflow based on the outcomes of its evaluations. Conclusion: The automation of image analysis processes through this sophisticated workflow not only enhances operational efficiency but also revolutionizes communication dynamics within Telegram interactions. By incorporating this advanced workflow solution, users can optimize their image analysis workflows, bolster communication efficacy, and unlock new levels of automation in image processing tasks.
OpenAI Chat Model node
Telegram node
+2

AI-Powered Children's English Storytelling on Telegram with OpenAI

Unleashing Creativity: Transforming Children's English Storytelling with Automation and AI Check this example: https://t.me/st0ries95 Summary In the realm of children's storytelling, automation is revolutionizing the way captivating tales are created and shared. This article highlights the transformative power of setting up a workflow for AI-powered children's English storytelling on Telegram. By delving into the use cases and steps involved, we uncover how this innovative approach is inspiring young minds and fostering a love for storytelling in children. Usecase The workflow for children's stories is a game-changer for content creators, educators, and parents seeking to engage children through imaginative and educational storytelling. Here's how this workflow is making a difference: Streamlined Content Creation: By providing a structured framework and automation for story generation, audio creation, and image production, the workflow simplifies the process of crafting captivating children's stories. Enhanced Educational Resources: Teachers can leverage this workflow to develop interactive educational materials that incorporate storytelling, making learning more engaging for students. Personalized Parental Engagement: Parents can share personalized stories with their children, nurturing a passion for reading and creativity while strengthening family bonds through shared storytelling experiences. Community Connection: Organizations and community groups can use the workflow to connect with their audience and promote literacy and creativity by creating and sharing children's stories. Inspiring Imagination: Through automated creation and sharing of enchanting stories, the workflow aims to spark imagination, inspire young minds, and instill a love for storytelling in children. Node Explanation OpenAI Chat Model: Utilizes the OpenAI Chat Model to generate text for the children's stories. Schedule Trigger: Triggers the workflow at set intervals (every 12 hours) to generate new stories. Recursive Character Text Splitter: Splits text into smaller chunks for processing. OpenAI Chat Model2: Another OpenAI Chat Model node for generating prompts for image creation. Send Story Text: Sends the generated story text to a specified Telegram chat. Send Audio for the Story: Sends audio files of the stories to the Telegram chat. Send Story Picture: Shares images related to the stories on Telegram. Create a Kids Stories: Generates captivating short tales for kids using prompts provided. Generate Audio for the Story: Converts generated text into audio files for storytelling. Create a Prompt for DALL-E: Creates prompts for generating images related to the stories. Generate a Picture for the Story: Generates pictures based on the prompts for visual storytelling. By embracing automation in children's storytelling, we unleash creativity, inspire young minds, and create magical experiences that resonate with both storytellers and listeners alike.
Telegram Trigger node
OpenAI node
Telegram node
Merge node
Aggregate node

Image Creation with OpenAI and Telegram

Image Creation with OpenAI and Telegram Check this channel: AutoTechAi_bot Description: In the realm of automation and artificial intelligence, n8n offers a sophisticated platform for seamlessly integrating AI algorithms to enhance image creation and communication processes. This innovative workflow leverages the capabilities of OpenAI and Telegram to facilitate creative image generation and streamline communication channels, ultimately enhancing user engagement and interaction. How to Use: Set Up Credentials: Configure credentials for the Telegram account and OpenAI API to enable seamless integration. Configure Nodes: Telegram Trigger Node: Set up the node to initiate the workflow based on incoming messages from users on Telegram. OpenAI Node: Utilize advanced AI algorithms to analyze text content from messages and generate intelligent responses. Telegram Node: Send processed data, including images and responses, back to users on Telegram for seamless communication. Merge Node: Organize and combine processed data for efficient handling and integration within the workflow. Aggregate Node: Aggregate all item data, including binaries if specified, for comprehensive reporting and analysis purposes. Run Workflow: Initiate the workflow to leverage AI-enhanced image processing and communication capabilities for enhanced user interactions. Monitor Execution: Keep an eye on the workflow execution for any errors or issues that may occur during processing. Customize Workflow: Tailor the workflow nodes, parameters, or AI models to align with specific business objectives and user engagement strategies. Experience Benefits: Embrace the power of AI-driven image processing and interactive communication on Telegram to elevate user engagement and satisfaction levels. By following these steps, businesses can unlock the transformative potential of AI integration in image creation and communication workflows using n8n. Elevate your user engagement strategies and deliver exceptional experiences to your audience through innovative AI-driven solutions. Embark on a journey of innovation and efficiency with AI integration in image creation and communication workflows using n8n!
Telegram Trigger node
Telegram node
OpenAI Chat Model node
+2

Translate Telegram audio messages with AI (55 supported languages)

Use case This workflow enables a Telegram bot that can: Accept speech input in one of 55 supported languages Automatically detect the language spoken and translate the speech to another language Responds back with the translated speech output. This allows users to communicate across language barriers by simply speaking to the bot, which will handle the translation seamlessly. How does it work? Translation In the translation step the workflow converts the user's speech input to text and detects the language of the input text. If it's English, it will translate to French. If it's French, it will translate to English. To change the default translation languages, you can update the prompt in the AI node. Output In the output step, we provide the translated text output back to the user and speech output is generated in the translated language. Setup steps Obtain Telegram API Token Start a chat with the BotFather. Enter /newbot and reply with your new bot's display name and username. Copy the bot token and use it in the Telegram node credentials in n8n. Update the Settings node to customize the desired languages Activate the flow Full list of supported languages All supported languages:
OpenAI Chat Model node
Telegram Trigger node
Telegram node
+4

Angie, Personal AI Assistant with Telegram Voice and Text

How it works: This project creates a personal AI assistant named Angie that operates through Telegram. Angie can summarize daily emails, look up calendar entries, remind users of upcoming tasks, and retrieve contact information. The assistant can interact with users via both voice and text inputs. Step-by-step: Telegram Trigger: The workflow starts with a Telegram trigger that listens for incoming message events. The system determines if the incoming message is voice or text. If voice, the voice file is retrieved and transcribed to text using OpenAI's API Speech to Text AI Assistant: The telegram request is passed to the AI assistant (Angie). Tools Integration: The AI assistant is equipped with several tools: Get Email: Uses Gmail API to fetch recent emails, filtering by date. Get Calendar: Retrieves calendar entries for specified dates. Get Tasks: Connects to a Baserow (open-source Airtable alternative) database to fetch to-do list items. Get Contacts: Also uses Baserow to retrieve contact information. Response Generation: The AI formulates a response based on the gathered information and sends back to the user on Telegram
Telegram Trigger node
Telegram node
OpenAI Chat Model node
+4

Traveler Co-Pilot: AI-Powered Telegram for Easy Language and Image Translation

Introduction The Traveler Co-Pilot empowers you to confidently traverse the world, connecting with ease and breaking language barriers: Engage in conversations with locals Navigate menus at foreign eateries Comprehend road signs effortlessly. Features Seamless Speech-to-Speech Translation** Communicate in any of the 55 supported languages, and witness the bot translate your words into another language in real-time, all through speech. Visual Translation Magic** Capture images containing text, and the bot will work its magic by recognizing and translating the text into the desired language, right before your eyes. Setup Steps Open the Settings node and specify the languages you would like to work with
OpenAI Chat Model node
OpenAI node
+2

AI-Powered Children's Arabic Storytelling on Telegram

Template for Kids' Story in Arabic The n8n template for creating kids' stories in Arabic offers a versatile platform for storytellers to captivate young audiences with educational and interactive tales. It allows for customization to suit various use cases and can be set up effortlessly. Check this example: https://t.me/st0ries95 Use Cases Educational Platforms: Educational platforms can automate the creation and distribution of educational stories in Arabic for children using this template. By incorporating visual and auditory elements into the storytelling process, educational platforms can enhance learning experiences and engage young learners effectively. Children's Libraries: Children's libraries can utilize this template to curate and share a diverse collection of Arabic stories with young readers. The automated generation of visual content and audio files enhances the storytelling experience, encouraging children to immerse themselves in new worlds and characters through captivating narratives. Language Learning Apps: Language learning apps focused on Arabic can integrate this template to offer culturally rich storytelling experiences for children learning the language. By translating stories into Arabic and supplementing them with visual and auditory components, these apps can facilitate language acquisition in an enjoyable and interactive manner. Configuration Guide for Nodes OpenAI Chat Model Nodes: Functionality**: Allows interaction with the OpenAI GPT-4 Turbo model. Purpose**: Enables communication with advanced chat capabilities. Create a Prompt for DALL-E Node: Customization**: Tailor prompts for generating relevant visual content. Summarization**: Define prompts for visual content generation without text. Generate an Image for the Story Node: Resource Type**: Specifies image as the resource. Prompt Setup**: Configures prompt for textless image creation within the visual content. Generate Audio for the Story Node: Resource Type**: Chooses audio as the resource. Input Definition**: Sets input text for audio file generation. Translate the Story to Arabic Node: Chunking Mode Selection**: Allows advanced chunking mode choice. Summarization Configuration**: Sets method and prompts for story translation into Arabic. Send the Story To Channel Node: Channel ID**: Specifies the channel ID for sending the story text. Text Configuration**: Sets up the text to be sent to the channel. By following these node descriptions, users can effectively configure the n8n template for kids' stories in Arabic, tailoring it to specific use cases for a seamless and engaging storytelling experience for young audiences.
Telegram Trigger node
OpenAI node
Spotify node
Merge node
+3

Telegram to Spotify with OpenAI

Search music and play to Spotify from Telegram This workflow is a simple demonstration on accessing a message model from Telegram and it makes searching for songs an easy task even if you can't remember the artist or song name. An OpenAI message model tries to figure out the song and sends it to an active Spotify device**. Use case Imagine an office where you play music in the background and the employees can control the music without having to login to the playing account. How it works You describe the song in Telegram. Telegram bot sends the text to n8n. An OpenAI message model tries to find the song. Spotify gets the search query string. First match is then added to queue. -- If there is no match a message is sent to Telegram and the process ends. We change to the next track in the list. We make sure the song starts playing by trying to resume. We fetch the currently playing track. We return "now playing" information to Telegram: Song Name - Artist Name - Album Name. Error handling Every Spotify step has it's on error handler under settings where we output the error. Message parser receives the error and sends it to Telegram. Requirements Active workflow* OpenAI API key Telegram bot Spotify account and Oauth2 API Spotify active on a device** .* The Telegram trigger is activated only if this workflow is active. You can however TEST the workflow in the editor by clicking "Test step" and then it waits for the Telegram event. When event is received, just step through all steps or just clicking "Test step" on the "Fetch Now Playing" node. .** You must have a Spotify device active when trying to communicate with a device. Open Spotify and play something - not it is active.
OpenAI Chat Model node
Telegram node
Telegram Trigger node
+4

Telegram AI bot assistant: ready-made template for voice & text messages

Free template for voice & text messages with short-term memory This n8n workflow template is a blueprint for an AI Telegram bot that processes both voice and text messages. Ready to use with minimal setup. The bot remembers the last several messages (10 by default), understands commands and provides responses in HTML. You can easily swap GPT-4 and Whisper for other language and speech-to-text models to suit your needs. Core Features Text: send or forward messages Voice: transcription via Whisper Extend this template by adding LangChain tools. Requirements Telegram Bot API OpenAI API (for GPT-4 and Whisper) 💡 New to Telegram bots? Check our step-by-step guide on creating your first bot and setting up OpenAI access. Use Cases Personal AI assistant Customer support automation Knowledge base interface Integration hub for services that you use: Connect to any API via HTTP Request Tool Trigger other n8n workflows with Workflow Tool

Build your own OpenAI and Telegram integration

Create custom OpenAI and Telegram workflows by choosing triggers and actions. Nodes come with global operations and settings, as well as app-specific parameters that can be configured. You can also use the HTTP Request node to query data from any app or service with a REST API.

OpenAI supported actions

Create an Assistant
Create a new assistant
Delete an Assistant
Delete an assistant from the account
List Assistants
List assistants in the organization
Message an Assistant
Send messages to an assistant
Update an Assistant
Update an existing assistant
Message a Model
Create a completion with GPT 3, 4, etc.
Classify Text for Violations
Check whether content complies with usage policies
Analyze Image
Take in images and answer questions about them
Generate an Image
Creates an image from a text prompt
Generate Audio
Creates audio from a text prompt
Transcribe a Recording
Transcribes audio into the text
Translate a Recording
Translate audio into the text in the english language
Delete a File
Delete a file from the server
List Files
Returns a list of files that belong to the user's organization
Upload a File
Upload a file that can be used across various endpoints

Telegram supported actions

Get
Get up to date information about a chat
Get Administrators
Get the Administrators of a chat
Get Member
Get the member of a chat
Leave
Leave a group, supergroup or channel
Set Description
Set the description of a chat
Set Title
Set the title of a chat
Answer Query
Send answer to callback query sent from inline keyboard
Answer Inline Query
Send answer to callback query sent from inline bot
Get
Get a file
Delete Chat Message
Delete a chat message
Edit Message Text
Edit a text message
Pin Chat Message
Pin a chat message
Send Animation
Send an animated file
Send Audio
Send a audio file
Send Chat Action
Send a chat action
Send Document
Send a document
Send Location
Send a location
Send Media Group
Send group of photos or videos to album
Send Message
Send a text message
Send Photo
Send a photo
Send Sticker
Send a sticker
Send Video
Send a video
Unpin Chat Message
Unpin a chat message

FAQs

  • Can OpenAI connect with Telegram?

  • Can I use OpenAI’s API with n8n?

  • Can I use Telegram’s API with n8n?

  • Is n8n secure for integrating OpenAI and Telegram?

  • How to get started with OpenAI and Telegram integration in n8n.io?

Looking to integrate OpenAI and Telegram in your company?

Over 3000 companies switch to n8n every single week

Why use n8n to integrate OpenAI with Telegram

Build complex workflows, really fast

Build complex workflows, really fast

Handle branching, merging and iteration easily.
Pause your workflow to wait for external events.

Code when you need it, UI when you don't

Simple debugging

Your data is displayed alongside your settings, making edge cases easy to track down.

Use templates to get started fast

Use 1000+ workflow templates available from our core team and our community.

Reuse your work

Copy and paste, easily import and export workflows.

Implement complex processes faster with n8n

red iconyellow iconred iconyellow icon