How to create a bot with Langflow and connect it to Telegram, Discord, or Slack

Last update: 28/07/2026

  • Langflow allows you to build artificial intelligence applications using interconnected visual components.
  • LangBot brings the created flows to Telegram, Discord, Slack, and other platforms.
  • The API Key and the flow identifier allow both applications to communicate correctly.
  • A shared Docker network avoids numerous errors when services use separate containers.
How to create a bot with Langflow and connect it to Telegram, Discord, or Slack

If you want to enter the world of artificial intelligence but are intimidated by thousands of lines of code, Langflow can make the process considerably easier. This open-source platform allows Build applications, agents, and artificial intelligence workflows using a visual interface in which the different components are connected to each other.

Instead of programming all the logic of an application from scratch, you can add blocks to receive a message, prepare instructions, consult documents, call a model, and return a response. Each block represents a specific function and has inputs and outputs compatible with certain data types.

This doesn't mean that Langflow completely eliminates the technical aspects. To create advanced applications, you still need to understand concepts such as prompts, models, tools, memory, embeddings, APIs and vector databasesThe difference is that you can visually organize these pieces, test them separately, and modify the flow without having to redo the entire program.

Langflow also allows you to publish flows via an API. Thanks to this feature, the prototype created in the editor can become the brain of an external application, a website, or a messaging bot. One way to do this is by combining Langflow with LangBot, a platform that connects AI systems with Telegram, Discord, Slack, LINE, WeChat and other services.

What is Langflow and what is it used for?

What is Langflow and what is it used for?

Langflow is a visual platform for building and running language model-based workflowsIts editor uses components that can be dragged onto the canvas and connected via ports, forming a processing sequence.

The available components include:

  • Chat entries and exits to receive and return messages.
  • Language models from different suppliers.
  • Prompts with dynamic instructions and variables.
  • Agents able to decide which tools to use.
  • File uploaders to process documents and other data.
  • Embedding models to represent information using vectors.
  • Vector databases to store and retrieve relevant content.
  • Tools and APIs that allow interaction with external services.
  • Memory components to preserve the history of conversations.

Although Langflow emerged closely linked to the LangChain ecosystem, it shouldn't be described solely as a graphical interface for this library. It currently offers its own component architecture, API, server, and deployment system, in addition to integrations with numerous providers.

Langflow is especially useful for prototyping, experimenting with different models, developing RAG systems, and exposing application logic through an API. It also allows you to create custom Python components when the included blocks don't meet a specific need.

Differences between a flow, a chain, and an agent

Before we begin, it is important to distinguish between several concepts that are often used interchangeably.

Un flow It is the complete set of components and connections that make up the application. It can contain inputs, prompts, models, tools, storage, and outputs.

A chain It executes a relatively predictable sequence. For example, it might receive a query, translate it, send it to a model, and then summarize the response. The output of one stage passes to the next following a predefined path.

Un agentInstead, it receives a goal and decides which tool to use to achieve it. It can query a database, perform a search, or execute several operations before responding.

It is also possible to build multi-agent systemswhere several agents perform different functions. One might gather information, another analyze it, and a third prepare the final response. However, connecting several models sequentially does not automatically transform a flow into a multi-agent system.

This difference is important because agents offer greater flexibility, but they can also consume more tokens, take longer, and make unexpected decisions. For a simple and predictable task, A conventional workflow is usually faster and easier to debug..

What role does LangBot play in this integration?

Langflow handles the execution of the AI ​​application's logic, but it doesn't directly manage all connections with services like Telegram, Discord, or Slack. For that, you can use LangBot.

LangBot is an open-source platform designed for create and manage bots on different messaging servicesIt manages message reception, connection with each platform, permissions, and sending responses to the end user.

The division of responsibilities is as follows:

  • Langflow acts as an artificial intelligence engine: It receives the message, executes the prompts, queries data, calls the model, and generates a response.
  • LangBot acts as an intermediary: It receives the message from Telegram, Discord or Slack, sends it to the flow and returns the result to the corresponding platform.

Therefore, LangBot doesn't automatically convert any diagram into a finished bot. First, you must Create and test the flow in Langflow, publish your endpoint and provide LangBot with the information needed to run it.

Exclusive content - Click Here  Introduction to Dreamweaver programming language.

Requirements to create a bot with Langflow and LangBot

Requirements to create a bot with Langflow and LangBot

Before you begin, you need to have the following tools installed or available:

  • Docker and Docker Compose, if you are going to run the applications using containers.
  • Langflow, installed locally or on an accessible server.
  • LangBot, installed using uv, Docker or one of its supported methods.
  • An API key from the model provider, unless you use a local model.
  • A token for Telegram, Discord, Slack, or another platform wherever you want to publish the bot.
  • A Langflow API Key to authorize calls to the flow.

You should also verify that LangBot can access the Langflow address. Ensure both applications function correctly in the browser. does not guarantee that they can communicate with each otherespecially when they are inside different containers.

For an initial test, you can run both tools on the same computer. Once the workflow is working, you can move it to a server, add a persistent database, and implement stricter security measures.

How to install Langflow using Docker

The quickest way to try Langflow is to use its official Docker image. A basic command would be the following:

docker run -d \
  --name langflow \
  -p 7860:7860 \
  -v langflow-data:/app/langflow \
  -e LANGFLOW_AUTO_LOGIN=false \
  -e LANGFLOW_SUPERUSER_PASSWORD=CAMBIA_ESTA_CONTRASENA \
  langflowai/langflow:latest

Then you can access the interface using:

http://localhost:7860

The volume langflow-data It allows you to preserve projects and settings when the container is recreated. Without it, You could lose the flows by removing or replacing the container.

You should not use a weak password or directly publish port 7860 on the internet. In a production environment, it is advisable to use HTTPS, restrict access, and deploy a suitable database, such as PostgreSQL.

How to install Langflow with Docker
Related article:
How to install Langflow with Docker step by step

How to install and open LangBot

LangBot offers different installation methods. For a quick test, you can run it using uvx, a tool included in the UV ecosystem:

uvx langbot

Once started, the administration panel is usually located at:

http://localhost:5300

This procedure is convenient for testing the application without manually setting up a Python environment. For a more durable deployment, LangBot also offers a Docker Compose-based configuration.

You shouldn't confuse LangBot's port 5300 with Langflow's 7860They are two independent applications, and each maintains its own panel, configuration, and process.

From LangBot, you'll need to establish a connection with your chosen messaging platform and configure the pipeline or provider responsible for generating responses. The exact names of some menus may vary between versions, but the Langflow integration uses its API to execute the published flow.

How to build the basic flow in Langflow

How to build the basic flow in Langflow

Before connecting it to LangBot, create a new flow from the Langflow interface. You can start with the template Basic Prompting or starting from a blank canvas.

A simple conversational flow might contain:

  • Chat Input: receives the message sent by the user.
  • Prompt: Add the instructions that define the bot's behavior.
  • Language Model: execute the selected model.
  • Chat Output: delivers the response produced by the model.

The general connection would be:

Chat Input → Prompt → Language Model → Chat Output

Within the model component, you'll need to choose a provider and configure their credentials. Langflow supports different models and integrations, so the available fields will depend on the option you select.

In the prompt you can write instructions like the following:

Eres un asistente de soporte técnico.
Responde en español con instrucciones claras y breves.
Si no conoces la respuesta, indícalo y no inventes información.

Pregunta del usuario:
{input}

The variable name must match the input connected to the component. If the prompt expects a different variable or does not receive the user's message, The model can ignore the query or always respond in the same way.

How to test the flow before publishing it

Open the Langflow Playground and send different messages. Don't just check that it returns a response: also examine how it handles long questions, empty inputs, ambiguous instructions, and queries for which it has no information.

If you use tools or documents, check that the model:

  • Invoke the appropriate tool when it is necessary.
  • It does not use a tool for questions you can answer directly.
  • Retrieve relevant fragments of the documentation.
  • He does not invent information when the source does not contain the answer.
  • It keeps the conversations separate. from different users.

This step is essential. If the flow doesn't work in the Playground, connecting it to LangBot will only add another layer of complexity and make it... it becomes more difficult to locate the source of the problem.

How to obtain the API Key and flow identifier

How to obtain the Langflow API Key and flow identifier

LangBot needs to know which flow to execute and have authorization to access it.

To create a key, open the Langflow user menu, enter Settings and look for the section Langflow API KeysCreate a new password, copy it, and save it in a password manager, because it may not be displayed in full again.

Langflow keys inherit the permissions of the user who creates them. Therefore, You should not share an administrator key or include it in screenshots, repositories, or public files..

Exclusive content - Click Here  Complete Guide to Sharing Open WebUI and Ollama on Your Local Network

To locate the flow, open it and enter:

Share → API access

From this section, you can view the generated endpoint and see code examples to run it. The address usually follows a structure similar to this:

http://localhost:7860/api/v1/run/IDENTIFICADOR_DEL_FLUJO

Langflow also allows you to assign a name to the endpoint. This makes it easier to use a recognizable address instead of a long identifier.

http://localhost:7860/api/v1/run/bot-soporte

Although the Flow ID may appear in different places in the interface or URL, Share and API access is the most reliable reference because it shows the endpoint that the external application should use.

How to manually check the Langflow API

Before configuring LangBot, it's advisable to send a request directly to the API. You can use the code provided by Langflow or run a test with curl:

curl --request POST \
  --url "http://localhost:7860/api/v1/run/IDENTIFICADOR_DEL_FLUJO" \
  --header "Content-Type: application/json" \
  --header "x-api-key: TU_API_KEY" \
  --data '{
    "input_value": "Hola, ¿puedes ayudarme?",
    "input_type": "chat",
    "output_type": "chat"
  }'

If this request fails, check the address, key, identifier, and Langflow logs before continuing.

The exact content of the body may vary depending on the inputs used in the flow. The API access panel generates examples tailored to the configuration, so It is preferable to copy the example produced by your own installation.

You can also consult the interactive API documentation at:

http://localhost:7860/docs

How to connect LangBot with the Langflow API

Once the API is verified, open the LangBot dashboard and create or edit the pipeline that the bot will use. Select the Langflow integration and enter the requested information.

You will typically need to provide:

  • Langflow base address: For example, http://localhost:7860.
  • API Key: the key created from the Langflow settings.
  • Flow ID or endpoint name: Identify the flow that needs to be executed.
  • Input parameters: allow the user's message to be sent correctly.

Next, you need to associate the pipeline with the corresponding bot or platform. For example, for Telegram, you'll need to create a bot using BotFather and enter its token into LangBot. Discord and Slack require their own applications, credentials, and permissions.

The complete flow will be as follows:

  1. The user sends a message from Telegram, Discord, or Slack.
  2. LangBot receives the message through platform integration.
  3. LangBot sends the query to the Langflow endpoint.
  4. Langflow executes the components, prompts, tools and models.
  5. Langflow returns the result to LangBot.
  6. LangBot delivers the answer to the user on the original platform.

How to connect Langflow and LangBot if you use Docker

How to connect Langflow and LangBot if you use Docker

When both applications run directly on the same machine, they can communicate using their local ports. However, within Docker, localhost It refers to the container itself.

If LangBot is inside a container and you configure:

http://localhost:7860

LangBot will look for Langflow within its own container. Since the service is located elsewhere, the connection will fail.

If both services are running using Docker Compose, the cleanest solution is to add them to a shared network and use the service name:

services:
  langflow:
    image: langflowai/langflow:latest
    ports:
      - "7860:7860"
    networks:
      - ia_network

  langbot:
    image: langbotio/langbot:latest
    ports:
      - "5300:5300"
    networks:
      - ia_network

networks:
  ia_network:

In this case, LangBot should access Langflow using an address similar to:

http://langflow:7860

The name langflow This corresponds to the service declared in Docker Compose.

If Langflow is running on the host computer and LangBot is inside Docker, you may need to use:

http://host.docker.internal:7860

The exact address depends on the operating system and Docker configuration. Therefore, it's recommended to test connectivity. from the environment where LangBot is actually runningnot only from the host's browser.

How to preserve the memory of conversations

If each message is sent to Langflow as a completely independent request, the model may not remember what the user said previously.

The Langflow Agent component has integrated chat memory. It can also be used Message History to retrieve messages stored in Langflow or compatible external services.

To properly separate conversations, requests should use a Stable Session IDLangBot should send the same identifier for messages belonging to the same conversation and a different one for each user, channel, or group.

If all users share the same Session ID, there is a risk that:

  • Different conversations get mixed up.
  • A user receives context belonging to another person.
  • The history grows unnecessarily.
  • The bot produces inconsistent responses or exposes data.

The exact strategy will depend on the integration, but it is usually convenient to build the identifier using the platform ID, the channel, and the user.

How to add documents using a RAG system

How to add documents using a RAG system

One of the most interesting uses of Langflow is creating a bot that responds using its own documentation. To do this, you can implement a system of Recovery Augmented Generation or RAG.

The process is normally divided into two parts:

  • Indexing: The documents are divided into fragments, converted into embeddings, and stored in a vector database.
  • Consultation: The user's question is transformed into a vector and the most related fragments are searched for before calling the model.
Exclusive content - Click Here  How to disable Copilot in the Edge sidebar

Langflow includes templates and components for working with document loaders, embedding models, and various vector databases. You can use a RAG template as a starting point and adapt it to your files.

To obtain reliable results, it is advisable to adjust:

  • The size and overlap of the fragments.
  • The model used to generate embeddings.
  • The number of results retrieved.
  • The prompt that forces you to respond based on the sources.
  • Access permissions to each documentary collection.

A RAG system does not guarantee that all responses will be correct. If retrieval finds irrelevant fragments or the prompt does not establish clear boundaries, The model can still misinterpret information or invent details..

Langflow and LangBot Use Cases

The combination of both tools allows you to publish the same AI system on different channels without rebuilding all the logic for each platform.

Some interesting use cases include:

  • Customer service bot who consults manuals, policies and frequently asked questions.
  • Internal Assistant connected with authorized corporate documentation.
  • Sales bot which gathers information and refers opportunities to the sales team.
  • Community Moderator from Discord or Telegram.
  • Technical Assistant capable of consulting a knowledge base.
  • Agent with tools to obtain information from APIs or databases.
  • Classification system which analyzes messages and directs them to the appropriate department.

For sensitive actions, such as modifying records, sending emails, or processing orders, it's advisable to require confirmation and carefully limit the available tools. An agent should not receive more permits than strictly necessary.

How to fix the most common connection errors

How to fix the most common connection errors in Langflow

If LangBot fails to execute the flow, the first step is to check if the API is working by making a manual call. This helps determine whether the error lies with Langflow, LangBot, or the network.

The most common errors are the following:

  • Incorrect Flow ID: The identifier of a component has been copied instead of the entire flow.
  • Invalid API Key: The key is incomplete, revoked, or belongs to a user without sufficient permissions.
  • Incorrect URL: has doubled /api or the complete endpoint has been entered in a field that only expected the domain and port.
  • Incorrect use of localhost: LangBot and Langflow are in different containers.
  • Inaccessible port: The service is not listening, the container has stopped, or there is an intermediate firewall.
  • Incompatible input format: the flow expects a different data type or variable name.
  • Supplier error: The model key is incorrect, has no balance, or has reached its limit.
  • Waiting time expired: The workflow takes too long because it consults documents, runs tools, or uses a slow model.

You should also review the logs of both services:

docker logs langflow
docker logs langbot

If you use Docker Compose, you can check the latest logs using:

docker compose logs --tail=200 langflow
docker compose logs --tail=200 langbot

Do not share complete logs without reviewing them, as they may contain internal addresses, usernames, passwords, or fragments of conversations.

Security and production deployment

An installation that runs on a local computer is not necessarily ready to be exposed to the internet. Before using the bot with real users, you must secure both Langflow and LangBot.

Recommended measures include:

  • Activate authentication and use strong passwords.
  • Save the keys as secrets or environment variablesnever directly in the code.
  • Use HTTPS through a reverse proxy.
  • Limit which ports are publicly exposed.
  • Apply usage restrictions and request limits.
  • Separate conversations using session identifiers.
  • Review the permissions granted to tools and agents.
  • Use persistent storage and perform backups.
  • Update images and dependencies regularly.

Enterprise applications also need to control which users can access each document, database, or tool. Connecting a private source to a RAG system does not imply that all bot users should be able to access it.

When is it worth using Langflow with LangBot

This combination is especially useful when you want separate the design of artificial intelligence from the integration with messaging platformsYou can modify the flow, change the model, or add documents without rebuilding the Telegram or Discord bot from scratch.

Langflow provides the visual editor, agents, tools, memory, and API. LangBot adds messaging channel connectivity, bot management, and response distribution.

For a simple prototype, the process can be completed in a short time. However, an application intended for real users needs testing, bug fixing, security, usage limits, and persistent storage.

Once communication is correctly configured, each message will follow the same path: LangBot receives it, Langflow executes the flow intelligence, and LangBot returns the response to the original channel.This architecture allows the same system to be used on multiple platforms and to continue improving it from the visual editor without modifying each bot individually.