Blog

How to Build a Telegram Bot with BuildShip and OpenAI Assistant

Tutorial

·

Jul 26, 2025

Creating a Telegram bot that leverages AI capabilities doesn't have to involve complex coding. With BuildShip's no-code platform, you can quickly set up a responsive Telegram bot powered by OpenAI's assistant technology. This guide walks you through the entire process, from setting up your workflow to connecting with Telegram and configuring your AI assistant.

Creating a Telegram bot that leverages AI capabilities doesn't have to involve complex coding. With BuildShip's no-code platform, you can quickly set up a responsive Telegram bot powered by OpenAI's assistant technology. This guide walks you through the entire process, from setting up your workflow to connecting with Telegram and configuring your AI assistant.

Creating a Telegram bot that leverages AI capabilities doesn't have to involve complex coding. With BuildShip's no-code platform, you can quickly set up a responsive Telegram bot powered by OpenAI's assistant technology. This guide walks you through the entire process, from setting up your workflow to connecting with Telegram and configuring your AI assistant.

Getting Started with BuildShip

Creating Your Telegram Bot Workflow

1. Log into your BuildShip account and create a new workflow

2. Search for "Telegram bot" in the template library

3. Click "Remix" on the Telegram bot template to use it as your starting point

The default template is configured to handle text inputs, with placeholder responses for voice messages and photos (full support for these formats is coming soon).

Understanding the Workflow Structure

The template workflow follows a logical sequence:

1. Input Collection: Captures username, chat ID, and text from Telegram

2. User Experience: Shows "typing" status in Telegram while processing

3. Message Handling: Routes text messages to the AI assistant

4. Response Generation: Uses OpenAI to create contextually relevant replies

5. Memory Management: Stores conversation history in BuildShip's database

The Input Handling Logic

When a message arrives, the workflow first checks if it contains text. If it does, the message is processed through the OpenAI assistant. If not (for example, if it's a voice message or photo), it currently sends a generic response.

Configuring Your OpenAI Assistant

To power your bot with AI capabilities, you'll need to connect an OpenAI assistant:

Setting Up Your OpenAI API Key

1. Visit platform.openai.com

2. Navigate to the API Keys section

3. Create a new secret key

4. Copy this key to BuildShip by clicking "Add Key" in the OpenAI assistant node

Creating Your Assistant

1. On the OpenAI platform, go to the Assistants section

2. Click "Create new assistant"

3. Name your assistant and select a model (GPT-4 is recommended for best results)

4. Copy the assistant ID

5. Paste this ID into the BuildShip workflow's OpenAI assistant node

Enhancing Your Assistant with Tools

The OpenAI assistant can be equipped with various tools to extend its capabilities:

- Web scraping for retrieving online information

- Database access (BuildShip, Supabase, Airtable)

- Perplexity lookup for research questions

- Custom tools for specific functionality

For a basic Telegram bot, you can start with the standard configuration and add tools later as your needs evolve.

Finalizing the Response Flow

After the OpenAI assistant generates a response, the workflow:

1. Sends the response back to the user via Telegram

2. Stores the conversation in BuildShip's database for context retention

3. Creates a document output if a thread ID exists (for conversation continuity)

Testing Your Workflow

Before connecting to Telegram, test your workflow within BuildShip:

1. Click the "Test" button at the top of the workflow

2. Enter a sample chat ID (any number will work for testing)

3. Type a test message like "Hi, how are you?"

4. Run the test to see the OpenAI assistant's response

This allows you to verify that your assistant is properly configured before going live.

Connecting to Telegram

Creating a Bot with BotFather

1. Open Telegram and search for "BotFather"

2. Start a chat with BotFather and type `/newbot`

3. Follow the prompts to name your bot and create a username

4. BotFather will provide a token - copy this token

Connecting Your Bot to BuildShip

1. Return to BuildShip and add your Telegram token as a new key

2. Make sure this key is selected in all Telegram-related nodes

3. Click "Connect" to establish the webhook connection

If you have multiple Telegram bots, double-check that the correct key is selected in each Telegram node throughout your workflow.

Deploying Your Bot

Once everything is configured:

1. Click "Ship" to deploy your workflow

2. Open Telegram and search for your bot's username

3. Start a conversation to test the live implementation

You should see the "typing" indicator appear when you send a message, followed by a contextually relevant response from your OpenAI assistant.

Setting Up Group Chat Functionality

If you want your bot to work in group chats:

1. Message BotFather with `/setprivacy`

2. Select your bot from the list

3. Choose one of two options:

- Disable group privacy: The bot will read all messages in groups (better for interactive bots)

- Enable group privacy: The bot will only respond to commands or when directly mentioned (better for utility bots)

Privacy Considerations

When disabling group privacy, your bot will have access to all messages sent in any group it joins. This provides more context for the AI but raises privacy considerations. Make sure group members are aware of this functionality if you choose this option.

Troubleshooting Common Issues

- Connection Errors: If you see "Error setting webhook," try connecting again - the first request sometimes fails

- No Response: Verify that your OpenAI API key has sufficient credits and the correct permissions

- Context Loss: If the bot isn't remembering previous messages, check that the database connection is working properly

- Multiple Bots Confusion: Ensure you've selected the correct Telegram key in all nodes if managing multiple bots

For a complete video tutorial, click below:

Future Enhancements

BuildShip is actively developing additional features for Telegram bots:

- Voice message processing

- Photo and image handling

- Enhanced group chat capabilities

- More integration options with external tools

Conclusion

Building a Telegram bot with BuildShip and OpenAI provides a powerful way to create interactive, AI-powered experiences without writing code. The combination of Telegram's reach, OpenAI's intelligence, and BuildShip's no-code platform makes it accessible to creators of all technical backgrounds.

By following this guide, you've created a bot that can maintain context across conversations, provide intelligent responses, and engage with users in both direct messages and group chats. As your needs grow, you can enhance your bot with additional tools and capabilities to create even more sophisticated experiences.

Happy building!

Getting Started with BuildShip

Creating Your Telegram Bot Workflow

1. Log into your BuildShip account and create a new workflow

2. Search for "Telegram bot" in the template library

3. Click "Remix" on the Telegram bot template to use it as your starting point

The default template is configured to handle text inputs, with placeholder responses for voice messages and photos (full support for these formats is coming soon).

Understanding the Workflow Structure

The template workflow follows a logical sequence:

1. Input Collection: Captures username, chat ID, and text from Telegram

2. User Experience: Shows "typing" status in Telegram while processing

3. Message Handling: Routes text messages to the AI assistant

4. Response Generation: Uses OpenAI to create contextually relevant replies

5. Memory Management: Stores conversation history in BuildShip's database

The Input Handling Logic

When a message arrives, the workflow first checks if it contains text. If it does, the message is processed through the OpenAI assistant. If not (for example, if it's a voice message or photo), it currently sends a generic response.

Configuring Your OpenAI Assistant

To power your bot with AI capabilities, you'll need to connect an OpenAI assistant:

Setting Up Your OpenAI API Key

1. Visit platform.openai.com

2. Navigate to the API Keys section

3. Create a new secret key

4. Copy this key to BuildShip by clicking "Add Key" in the OpenAI assistant node

Creating Your Assistant

1. On the OpenAI platform, go to the Assistants section

2. Click "Create new assistant"

3. Name your assistant and select a model (GPT-4 is recommended for best results)

4. Copy the assistant ID

5. Paste this ID into the BuildShip workflow's OpenAI assistant node

Enhancing Your Assistant with Tools

The OpenAI assistant can be equipped with various tools to extend its capabilities:

- Web scraping for retrieving online information

- Database access (BuildShip, Supabase, Airtable)

- Perplexity lookup for research questions

- Custom tools for specific functionality

For a basic Telegram bot, you can start with the standard configuration and add tools later as your needs evolve.

Finalizing the Response Flow

After the OpenAI assistant generates a response, the workflow:

1. Sends the response back to the user via Telegram

2. Stores the conversation in BuildShip's database for context retention

3. Creates a document output if a thread ID exists (for conversation continuity)

Testing Your Workflow

Before connecting to Telegram, test your workflow within BuildShip:

1. Click the "Test" button at the top of the workflow

2. Enter a sample chat ID (any number will work for testing)

3. Type a test message like "Hi, how are you?"

4. Run the test to see the OpenAI assistant's response

This allows you to verify that your assistant is properly configured before going live.

Connecting to Telegram

Creating a Bot with BotFather

1. Open Telegram and search for "BotFather"

2. Start a chat with BotFather and type `/newbot`

3. Follow the prompts to name your bot and create a username

4. BotFather will provide a token - copy this token

Connecting Your Bot to BuildShip

1. Return to BuildShip and add your Telegram token as a new key

2. Make sure this key is selected in all Telegram-related nodes

3. Click "Connect" to establish the webhook connection

If you have multiple Telegram bots, double-check that the correct key is selected in each Telegram node throughout your workflow.

Deploying Your Bot

Once everything is configured:

1. Click "Ship" to deploy your workflow

2. Open Telegram and search for your bot's username

3. Start a conversation to test the live implementation

You should see the "typing" indicator appear when you send a message, followed by a contextually relevant response from your OpenAI assistant.

Setting Up Group Chat Functionality

If you want your bot to work in group chats:

1. Message BotFather with `/setprivacy`

2. Select your bot from the list

3. Choose one of two options:

- Disable group privacy: The bot will read all messages in groups (better for interactive bots)

- Enable group privacy: The bot will only respond to commands or when directly mentioned (better for utility bots)

Privacy Considerations

When disabling group privacy, your bot will have access to all messages sent in any group it joins. This provides more context for the AI but raises privacy considerations. Make sure group members are aware of this functionality if you choose this option.

Troubleshooting Common Issues

- Connection Errors: If you see "Error setting webhook," try connecting again - the first request sometimes fails

- No Response: Verify that your OpenAI API key has sufficient credits and the correct permissions

- Context Loss: If the bot isn't remembering previous messages, check that the database connection is working properly

- Multiple Bots Confusion: Ensure you've selected the correct Telegram key in all nodes if managing multiple bots

For a complete video tutorial, click below:

Future Enhancements

BuildShip is actively developing additional features for Telegram bots:

- Voice message processing

- Photo and image handling

- Enhanced group chat capabilities

- More integration options with external tools

Conclusion

Building a Telegram bot with BuildShip and OpenAI provides a powerful way to create interactive, AI-powered experiences without writing code. The combination of Telegram's reach, OpenAI's intelligence, and BuildShip's no-code platform makes it accessible to creators of all technical backgrounds.

By following this guide, you've created a bot that can maintain context across conversations, provide intelligent responses, and engage with users in both direct messages and group chats. As your needs grow, you can enhance your bot with additional tools and capabilities to create even more sophisticated experiences.

Happy building!

Getting Started with BuildShip

Creating Your Telegram Bot Workflow

1. Log into your BuildShip account and create a new workflow

2. Search for "Telegram bot" in the template library

3. Click "Remix" on the Telegram bot template to use it as your starting point

The default template is configured to handle text inputs, with placeholder responses for voice messages and photos (full support for these formats is coming soon).

Understanding the Workflow Structure

The template workflow follows a logical sequence:

1. Input Collection: Captures username, chat ID, and text from Telegram

2. User Experience: Shows "typing" status in Telegram while processing

3. Message Handling: Routes text messages to the AI assistant

4. Response Generation: Uses OpenAI to create contextually relevant replies

5. Memory Management: Stores conversation history in BuildShip's database

The Input Handling Logic

When a message arrives, the workflow first checks if it contains text. If it does, the message is processed through the OpenAI assistant. If not (for example, if it's a voice message or photo), it currently sends a generic response.

Configuring Your OpenAI Assistant

To power your bot with AI capabilities, you'll need to connect an OpenAI assistant:

Setting Up Your OpenAI API Key

1. Visit platform.openai.com

2. Navigate to the API Keys section

3. Create a new secret key

4. Copy this key to BuildShip by clicking "Add Key" in the OpenAI assistant node

Creating Your Assistant

1. On the OpenAI platform, go to the Assistants section

2. Click "Create new assistant"

3. Name your assistant and select a model (GPT-4 is recommended for best results)

4. Copy the assistant ID

5. Paste this ID into the BuildShip workflow's OpenAI assistant node

Enhancing Your Assistant with Tools

The OpenAI assistant can be equipped with various tools to extend its capabilities:

- Web scraping for retrieving online information

- Database access (BuildShip, Supabase, Airtable)

- Perplexity lookup for research questions

- Custom tools for specific functionality

For a basic Telegram bot, you can start with the standard configuration and add tools later as your needs evolve.

Finalizing the Response Flow

After the OpenAI assistant generates a response, the workflow:

1. Sends the response back to the user via Telegram

2. Stores the conversation in BuildShip's database for context retention

3. Creates a document output if a thread ID exists (for conversation continuity)

Testing Your Workflow

Before connecting to Telegram, test your workflow within BuildShip:

1. Click the "Test" button at the top of the workflow

2. Enter a sample chat ID (any number will work for testing)

3. Type a test message like "Hi, how are you?"

4. Run the test to see the OpenAI assistant's response

This allows you to verify that your assistant is properly configured before going live.

Connecting to Telegram

Creating a Bot with BotFather

1. Open Telegram and search for "BotFather"

2. Start a chat with BotFather and type `/newbot`

3. Follow the prompts to name your bot and create a username

4. BotFather will provide a token - copy this token

Connecting Your Bot to BuildShip

1. Return to BuildShip and add your Telegram token as a new key

2. Make sure this key is selected in all Telegram-related nodes

3. Click "Connect" to establish the webhook connection

If you have multiple Telegram bots, double-check that the correct key is selected in each Telegram node throughout your workflow.

Deploying Your Bot

Once everything is configured:

1. Click "Ship" to deploy your workflow

2. Open Telegram and search for your bot's username

3. Start a conversation to test the live implementation

You should see the "typing" indicator appear when you send a message, followed by a contextually relevant response from your OpenAI assistant.

Setting Up Group Chat Functionality

If you want your bot to work in group chats:

1. Message BotFather with `/setprivacy`

2. Select your bot from the list

3. Choose one of two options:

- Disable group privacy: The bot will read all messages in groups (better for interactive bots)

- Enable group privacy: The bot will only respond to commands or when directly mentioned (better for utility bots)

Privacy Considerations

When disabling group privacy, your bot will have access to all messages sent in any group it joins. This provides more context for the AI but raises privacy considerations. Make sure group members are aware of this functionality if you choose this option.

Troubleshooting Common Issues

- Connection Errors: If you see "Error setting webhook," try connecting again - the first request sometimes fails

- No Response: Verify that your OpenAI API key has sufficient credits and the correct permissions

- Context Loss: If the bot isn't remembering previous messages, check that the database connection is working properly

- Multiple Bots Confusion: Ensure you've selected the correct Telegram key in all nodes if managing multiple bots

For a complete video tutorial, click below:

Future Enhancements

BuildShip is actively developing additional features for Telegram bots:

- Voice message processing

- Photo and image handling

- Enhanced group chat capabilities

- More integration options with external tools

Conclusion

Building a Telegram bot with BuildShip and OpenAI provides a powerful way to create interactive, AI-powered experiences without writing code. The combination of Telegram's reach, OpenAI's intelligence, and BuildShip's no-code platform makes it accessible to creators of all technical backgrounds.

By following this guide, you've created a bot that can maintain context across conversations, provide intelligent responses, and engage with users in both direct messages and group chats. As your needs grow, you can enhance your bot with additional tools and capabilities to create even more sophisticated experiences.

Happy building!

Start building your
BIGGEST ideas
in the *simplest* of ways.

Start building your
BIGGEST ideas
in the *simplest* of ways.

Start building your
BIGGEST ideas
in the *simplest* of ways.

You might also like