Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
The-x-35 committed Jan 11, 2025
1 parent 677d174 commit 14d4d46
Show file tree
Hide file tree
Showing 58 changed files with 11,372 additions and 22 deletions.
31 changes: 10 additions & 21 deletions examples/tg-bot-starter/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
# Telegram Bot Starter with Solana Agent Kit
We have three guides on how you can host Solana Agent Kit as a Telegram bot:

This example showcases how we can make a telegram bot with the Solana Agent Kit by Send AI.
1. **Basic TG Bot**: This guide explains how to run a simple Solana Agent Kit on a Telegram bot for a single user.

## Quick Deploy
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fsendaifun%2Fsolana-agent-kit%2Ftree%2Fmain%2Fexamples%2Ftg-bot-starter&env=OPENAI_API_KEY,RPC_URL,SOLANA_PRIVATE_KEY,TELEGRAM_BOT_TOKEN&project-name=solana-agent-kit&repository-name=sak-yourprojectname)

## How to get the telegram bot token

You can check [here](https://help.zoho.com/portal/en/kb/desk/support-channels/instant-messaging/telegram/articles/telegram-integration-with-zoho-desk#How_to_find_a_token_for_an_existing_Telegram_Bot) how you can obtain a bot token for your telegram bot.

## How to setup the project

- Set env variables
- Run ``` pnpm install ```
- Run ``` pnpm run dev ```
- Run ``` ngrok http 3000 ```
- With the URL you got from ngrok, where your bot is hosted at https://yourUrl.app/api/bot
- Set the webhook by using this command ``` curl https://api.telegram.org/bot<telegram_bot_token>/setWebhook?url=https://<your-deployment-url>.app/api/bot ``` or simply clicking on that link.
- You can host it on Vercel too as we have used NextJs in this.
- Once the URL is set successfully, you will see this ``` {"ok":true,"result":true,"description":"Webhook was set"} ```

Done!!! Congratulations you just hosted Solana Agent Kit on a Telegram bot.
2. **Advanced TG Bot**: This guide includes advanced features such as:
- Storing chat history for each user in a PostgreSQL database.
- Maintaining a unique wallet for each user in a Firebase database.
- Managing the chats of multiple users simultaneously.

3. **Group TG Bot**: This example demonstrates how to create a Telegram bot using the Solana Agent Kit by Send AI. It includes advanced features such as:
- Storing chat history for each user in a PostgreSQL database.
- Maintaining a unique wallet for each user in a Firebase database.
- This special bot can be run in Telegram groups and handle private conversations, such as wallet addresses, in private chats. It works in groups, maintains a separate context for each user, responds to each user by tagging them, and can handle multiple requests simultaneously. It will only reply if the bot is tagged in the group or its message is replied to.
10 changes: 10 additions & 0 deletions examples/tg-bot-starter/advanced-tg-bot/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
OPENAI_API_KEY=
RPC_URL=
TELEGRAM_BOT_TOKEN=
NEXT_PUBLIC_FIREBASE_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
NEXT_PUBLIC_FIREBASE_APP_ID=
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=
POSTGRES_LINK=
File renamed without changes.
24 changes: 24 additions & 0 deletions examples/tg-bot-starter/advanced-tg-bot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Telegram Bot Starter with Solana Agent Kit

This example demonstrates how to create a Telegram bot using the Solana Agent Kit by Send AI. It includes advanced features such as storing chat history for each user in a PostgreSQL database, maintaining a unique wallet for each user in a Firebase database, and managing the state of multiple users simultaneously, each with their own unique wallet.

## Quick Deploy
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fsendaifun%2Fsolana-agent-kit%2Ftree%2Fmain%2Fexamples%2Ftg-bot-starter&env=OPENAI_API_KEY,RPC_URL,SOLANA_PRIVATE_KEY,TELEGRAM_BOT_TOKEN&project-name=solana-agent-kit&repository-name=sak-yourprojectname)

## How to get the telegram bot token

You can check [here](https://help.zoho.com/portal/en/kb/desk/support-channels/instant-messaging/telegram/articles/telegram-integration-with-zoho-desk#How_to_find_a_token_for_an_existing_Telegram_Bot) how you can obtain a bot token for your telegram bot.

## How to setup the project

- Set env variables
- Run ``` pnpm install ```
- Run ``` pnpm run dev ```
- Run ``` ngrok http 3000 ```
- With the URL you got from ngrok, where your bot is hosted at https://yourUrl.app/api/bot
- Set the webhook by using this command ``` curl https://api.telegram.org/bot<telegram_bot_token>/setWebhook?url=https://<your-deployment-url>.app/api/bot ``` or simply clicking on that link.
- You can host it on Vercel too as we have used NextJs in this.
- Once the URL is set successfully, you will see this ``` {"ok":true,"result":true,"description":"Webhook was set"} ```

Done!!! Congratulations you just hosted Solana Agent Kit on a Telegram bot.

File renamed without changes.
33 changes: 33 additions & 0 deletions examples/tg-bot-starter/advanced-tg-bot/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "tg-bot-starter",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@langchain/core": "^0.3.26",
"@langchain/langgraph": "^0.2.36",
"@langchain/langgraph-checkpoint-postgres": "^0.0.2",
"@langchain/openai": "^0.3.16",
"firebase": "^11.1.0",
"grammy": "^1.33.0",
"messages": "link:@langchain/core/messages",
"next": "15.1.3",
"prebuilt": "link:@langchain/langgraph/prebuilt",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"solana-agent-kit": "^1.3.0"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}
Loading

0 comments on commit 14d4d46

Please sign in to comment.