Workflows

Telegram Bot with Supabase memory and OpenAI integration

Explore this Workflow. Built for next generation AI app & agent building.

Who is this for?

This workflow is perfect for developers, chatbot enthusiasts, and businesses interested in building a dynamic Telegram bot with memory capabilities. The bot uses OpenAI's assistant for interactions and integrates with Supabase to store user data, enabling personalized conversations.

What problem does this workflow solve?

Many basic chatbots lack memory and context awareness. This workflow solves that issue by integrating Supabase to track user sessions (using telegram_id and openai_thread_id), allowing the bot to remember past interactions, creating a more engaging and human-like experience.

What this workflow does

This Telegram bot template connects with OpenAI to respond to user queries while storing and retrieving user information from Supabase. The memory component allows the bot to reference previous interactions, making it suitable for customer support, virtual assistants, or any application where context retention is valuable.

     
  • Receive New Message: The bot listens for incoming messages from users on Telegram.
  •  
  • Check User in Database: Checks if the user exists in Supabase using telegram_id.
  •  
  • Create New User (if necessary): Adds a new user record in Supabase with telegram_id and openai_thread_id if the user is new.
  •  
  • Start or Continue Conversation with OpenAI: Initiates a new thread or continues an existing one using the stored openai_thread_id.
  •  
  • Merge Data: Combines user-specific data and conversation context.
  •  
  • Send and Receive Messages: Sends the message to OpenAI and processes the response.
  •  
  • Reply to User: Sends OpenAI's response back to the user on Telegram.

Setup

     
  1. Create a Telegram Bot using Botfather and get the bot token.
  2.  
  3. Set up Supabase:    
           
    1. Create a new project and obtain SUPABASE_URL and SUPABASE_KEY.
    2.      
    3. Create a new table named telegram_users with the following SQL query:
    4.    
       CREATE TABLE public.telegram_users (id UUID NOT NULL DEFAULT gen_random_uuid(), date_created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT (now() at time zone 'utc'::text), telegram_id BIGINT NULL, openai_thread_id TEXT NULL, CONSTRAINT telegram_users_pkey PRIMARY KEY (id)) TABLESPACE pg_default;  
  4.  
  5. OpenAI Setup:    
           
    1. Create an OpenAI assistant and obtain the OPENAI_API_KEY.
    2.      
    3. Customize the assistant’s personality or use case as needed.
    4.    
     
  6.  
  7. Environment Configuration in rantir:    
           
    1. Configure Telegram, Supabase, and OpenAI nodes with the required credentials.
    2.      
    3. Set up triggers to receive messages and handle conversation logic.
    4.      
    5. Input the OpenAI assistant ID in the "++OPENAI - Run assistant++" node.
    6.    
     
Workflow Elements
HTTP Request
Telegram
Supabase
If
Merge
Telegram Trigger
Sticky Note

Other workflows like this one

Your connected stack awaits to automate AI workflows with 24-7 uptime performance and engagement

Actioning Your Meeting Next Steps using Transcripts and AI

HTTP Request
Edit Fields (Set)
Google Drive
Switch
Google Calendar

Breakdown Documents into Study Notes using Templating MistralAI and Qdrant

Merge
Edit Fields (Set)
Loop Over Items (Split in Batches)
Switch
Wait

Build a Tax and Financial Assistant with AI

HTTP Request
Edit Fields (Set)
Loop Over Items (Split in Batches)
Switch
Compression

Building Chatbot for Movie Recommendations

GitHub
HTTP Request
Merge
Edit Fields (Set)
Sticky Note

WordPress or Webflow AI Chatbot with Rantir and OpenAI

HTTP Request
Merge
Postgres
Edit Fields (Set)
Loop Over Items (Split in Batches)

AI-powered WooCommerce Support-Agent

HTTP Request
If
Merge
Edit Fields (Set)
Webhook
Average ROI

401%

In ROI when switching to Rantir for automating their website, operations & integrations with AI.
average cost savings

+$128K

In Average savings from SaaS subscriptions, annually, and 2 optimized employee positions
startups Funding

$2.3B

Over $2 Billion dollars have been raised by our startup clients using Rantir for Services & Software.

They love working with Rantir

12x Signups for
Virtual Events

"I highly recommend Rantir, they are a great dev team with quick turn around on all projects and requests. We recently worked with them on updating our website and any changes, updates or modifications I needed were always taken care of quickly!"

Paige J.
Design Exp. Director

4X in Traffic

"The team at Rantir has lived up to every definition of the word "partner". They're adaptive, fast, and flexible (all the things you'd hope for). We're so thrilled with what we've accomplished so far and look forward to working alongside them in the future."

Kate W.
Marketing Director, Scoop

188% More Signups

"Working with the Rantir team was a pleasure. They guided us through the whole process from design to implementation, creating a great site on a tight deadline. They were responsive and adaptable throughout, and we'd be happy to work with them again in the future."

Garath W.
Growth Manager

Acquisition & Merger

"Working with the Rantir team early on made combined design and development with early conversations to implement AI within Onder. We were happy to work together to help bring no-code, with code and AI."

David K.
Head of Product

Over 700+ Talent and Rantir Partners to help you get started. Including Us.

Hire us for customization & AI development.  

Graphic.
AI No-Coder
Tayler F.
I generate beautiful, connected, landers with AI No Code software
Generative AI Art & Video
Avatar Placeholder
Malika V.
I onboard you to Flux, Midjourney & Synthesia or HeyGen
AI Marketing Flows
Avatar Placeholder
Bruno F.
I teach AI Marking & automated outreach
Generative software engineer
Avatar Placeholder
Christian B.
I help you onboard Cursor or Rantir with generating code

Join the Rantir Community around the world

Map.

AI Agents are the new Apps. Websites are the new Software.

Rantir University for learning how to build powerful AI Agents & Software you own.

Graphic.