flows-network / openai-assistant-telegram

Connect your OpenAI applications based on the Assistant API to Telegram
Apache License 2.0
22 stars 3 forks source link

A Telegram bot for you OpenAI Assistant Applications

flows.network Discord flows.network Twitter Create a flow

Deploy this function on flows.network, and you will get a Telegram 🤖 to interact with your OpenAI applications based on the Assitant APIs. It helps expand the usage of your Assistants apps and connect the app with your audiences. It's an essential but simple step to make your Assistant apps in production.

How it works

This flow function (or 🤖) will be triggered when a new message is sent to the Telegram bot. Then, the flow function will create a new thread for this user, call the retrieval API from OpenAI's Assistants, and finally answer the user's questions. The user can also type /restart to the bot to create a new thread.

Deploy your telegram bot in 3 simple steps

  1. Create a bot from a template
  2. Configure the Configurations

0 Prerequisites

Before we start, you need to create an Assistants app with the OpenAI playground. The OpenAI's Assistant basically is a RAG-based LLM agent. You can upload your own knowledge base to customize the Assistant's behavior and make sure the assistant provides correct answers. After that, you can easily see your assistant ID beginning with asst_ on the dashboard. You will need to bring your own OpenAI API key.

You will also need to sign into flows.network from your GitHub account. It is free.

1 Create a bot from a template

Just click here to load the template.

2 Configure the Configurations

image

Review the four configurations.

Congiguration Description
ASSISTANT_ID Get the Assistant ID from the OpenAI Assistants dashboard
OPENAI_API_KEY OpenAI API key
telegram_token Get the Telegram token from @botfather

Then click on the Create and Build button to continue.

We don't need to set up other SaaS providers here. Click Deploy to finish the deployment.

Wait for the magic!

This is it! You are now on the flow details page waiting for the flow function to build. As soon as the flow's status becomes running, the bot is ready to answer questions from your users!

image

If you don't want to use OpenAI to create embeddings for your domain knowledge, please refer to