# OpenAI Assistant Telegram Bot Template

## Introduction

This repository contains a template project for connecting a Telegram bot to the OpenAI Assistant API. It was developed as a proof of concept during an [Hack4AI](https://hack4ai.devpost.com/) hosted by https://www.startuphouse.lv/. 

It was made by team [Orbit8](https://devpost.com/software/digital-career-assistant)


The core functionality of this bot is to demonstrate how to integrate Telegram with the OpenAI Assistant, making it a versatile starting point for developers looking to create their own AI-powered Telegram bots. The specific actions and responses of the bot can be customized according to the OpenAI Assistant prompts configured by the developer.

## Diagram

![pako_enqvvg1r2zaq_itcdnabgzw7bhldpnttugx2epovtmeyin1jtdlskp2bzqx_fsfzcv5ib_smn-55nrvnznrkus6ap_yif6evcqnazioxlfgcgysei3kuwrgruq_ydhafoninbrowr1dcwoikvduymkek9muj6nzmzq2vfovcdj4zz4oij2csvie1x2w8qzqijlvqffrhmvr3ttqslepn8bb2nhozf-wkm64tqvxz3qo](https://github.com/wonderwhy-er/openai-assistant-telegram-bot-node-js/assets/1150639/5c125d52-510f-42d6-9a11-ca090842afa3)


## Features

- Template for setting up a Telegram bot integrated with the OpenAI Assistant API. .
- Simple setup process for quick deployment and testing.

## Technologies Used

- Node.js
- Telegram Bot API
- OpenAI Assistant API

## Setup and Installation

1. Clone the repository:
   ```bash
   git clone https://github.com/your-repo/openai-assistant-telegram-bot-node-js.git
   ```
2. Navigate to the project directory:
   ```bash
   cd openai-assistant-telegram-bot-node-js
   ```
3. Install the necessary dependencies:
   ```bash
   npm install
   ```
4. Start the bot:
   ```bash
   npm run start
   ```
   The start script will guide you through the setup process, including configuring the necessary API keys and other settings.

## Usage

After starting the bot, it will be running and listening for messages. The behavior and responses of the bot can be customized by modifying the OpenAI Assistant prompts within the code. Experiment with different prompts to achieve the desired functionality and interactions.

## TODOs
- what thing we wanted to add was streaming. Currently we wait for full response which is slow. Would be nice to do streaming and already send messages to Telegram as parts come in 

## Contributing

Contributions to this template are welcome! Please feel free to fork the repository, make your changes, and submit a pull request.

## License

This project is licensed under the MIT License - see the LICENSE file for details.