A production-ready Telegram Bot SDK for seamlessly integrating the Rasedi Payment Gateway natively within Telegram. This application provides an end-to-end interactive dashboard for users to generate, share, check, and cancel Rasedi payment checkout links dynamically inside Telegram chats.
- Multi-Language (i18n) Engine: Fully localized prompt interfaces natively supporting English, Arabic, and Kurdish.
- Interactive Configuration Dashboard: Users can visually manage their API
PrivateKey,SecretKey, mandatory URL routing, and Gateway Toggles directly inside the bot interface. - Deep-Link Sharing Integration: Generates robust Telegram deep links (
t.me/share/url) alongside successful payment tickets allowing users to instantly forward checkout URLs to groups and channels. - Ed25519 Cryptographic Security: Fully replicates the Rasedi Backend authentication flow on Node.js using
@noble/ed25519, safely and securely signing outbound payload requests. - Docker & AWS ECS Ready: Pre-configured architecture for scalable deployments on AWS native infrastructure.
- Node.js 18+
- A valid Telegram Bot Token from @BotFather
- Rasedi API Base Credentials
-
Clone the Repository
git clone git@github.com:MirotechTeam/rasedi-telegram-bot.git cd rasedi-telegram-bot -
Install Dependencies
npm install
-
Configure Environment Variables Duplicate
.env.exampleinto a local.envand assign your bot token.cp .env.example .env
.envFile:TELEGRAM_BOT_TOKEN="your_telegram_bot_token" WEBHOOK_BASE_URL="https://yourwebsite.com" # Fallback webhook URL for Rasedi Callbacks
By running the bot in dev mode, hot-reloading ensures fast prototyping:
npm run devnpm run build
npm startOnce running, send /start to your bot on Telegram to initialize the interactive payment onboarding!
For cloud environments, we provide an optimized, multi-stage Alpine Dockerfile.
-
Build the container image:
docker build -t rasedi-telegram-bot . -
Run securely: Ensure you pass the required environment variables during runtime.
docker run -d -e TELEGRAM_BOT_TOKEN="token" rasedi-telegram-bot
Note on State Storage: By default, user credentials and localization settings are securely written to
users_db.json. When deploying continuously to stateless environments like AWS ECS (Fargate), you are advised to mount the JSON path onto an AWS EFS volume or map the storage driver to a PostgreSQL/DynamoDB cluster.
The application utilizes Telegraf to handle complex user conversation steps (State Machines).
/src/example/locales.ts: Modifies or overrides bot translation data mappings./src/rasedi/client.ts: Core API transport mechanism handling serialization across gateways./src/bot.ts: Presentation wrappers dynamically rendering Telegram Inline Keyboards and deep links.