Skip to content

Telegram bot on Aiogram library for working with smshub.org API.

License

Notifications You must be signed in to change notification settings

4erdenko/smshub_aiogram_light

Repository files navigation

SMSHub-API-Telegram-Bot

This project demonstrates a Telegram Bot designed to interact with the smshub.org API for managing phone numbers. It provides a simple and convenient interface for viewing balance, buying numbers, and managing status (cancellation, getting a new code, finishing the number). It is implemented using Python, aiogram, and asyncio.

Features

  • Get balance from your smshub.org account.
  • Buy phone numbers from various services.
  • Cancel numbers, get new codes, and finish numbers.
  • Convenient user interface using Telegram Bot.
  • Restrict access to the bot only to your own Telegram ID.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

You need Python 3.8 or later to run the bot. You can have multiple Python versions (2.x and 3.x) installed on the same system without problems.

In Ubuntu, Mint, and Debian you can install Python like this:

sudo apt-get install python3 python3-pip

For other Linux flavors, macOS, and Windows, packages are available at

http://www.python.org/getit/

Quick Start

Clone the repository:

git clone https://github.com/yourusername/smshub-api-telegram-bot.git
cd smshub-api-telegram-bot

Create a virtual environment to isolate your dependencies:

python3 -m venv venv
source venv/bin/activate

Install the python dependencies:

pip install -r requirements.txt

Create a .env file and update the content:

cp .env.example .env
nano .env

Your .env file should look like this:

SMSHUB_API=your_sms_hub_api_key
BOT_TOKEN=your_telegram_bot_token
MY_CHAT_ID=your_telegram_chat_id
SERVICES_DICT='{"ServiceName1": "code1", "ServiceName2": "code2", ...}'

To get your Telegram Chat ID, you can use @userinfobot on Telegram. Simply forward a message to this bot, and it will reply with the user info, including the Chat ID.

Running the Bot

To start the bot, run the following command:

python main.py

Now, you can go to your Telegram App and interact with your bot.

Usage

  • Use /start command to initiate interaction with the bot.
  • Click on '💵 Balance' to get the balance from your smshub.org account.
  • Click on '📞 Buy number' to buy a phone number from a list of available services.
  • When a number is bought, you can click 'Cancel' to cancel the number, 'Get new code' to get a new code for the number, and 'Finish' to mark the number as finished.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

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

Acknowledgments

  • aiogram: An async Python framework for Telegram Bot API.
  • httpx: A fully featured HTTP client for Python 3.6+.

About

Telegram bot on Aiogram library for working with smshub.org API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published