A Telegram bot for SMS verification resellers
Quick answer
A Telegram bot is a simple front end for selling verification numbers. The bot takes a command like /code tg us, calls POST /api/v1/numbers, replies with the number and polls GET /api/v1/numbers/{id} until the code arrives. In production, add your own user balances, use the sms.received webhook instead of polling, and keep your customers to the Acceptable Use Policy.
This example uses python-telegram-bot and httpx. It's a starting point, not a finished store.
Minimal bot
# Minimal Telegram bot: /code <service> <country> (python-telegram-bot v21)
import os, asyncio, httpx
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes
API = "https://noirsms.com/api/v1"
H = {"Authorization": f"Bearer {os.environ['NOIRSMS_KEY']}"}
async def code(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
service, country = ctx.args[0], ctx.args[1]
async with httpx.AsyncClient(headers=H, timeout=20) as c:
n = (await c.post(f"{API}/numbers", json={"service": service, "country": country})).json()
if "error" in n:
return await update.message.reply_text(n["error"]["message"])
await update.message.reply_text(f"Your number: +{n['phone']}")
for _ in range(300):
s = (await c.get(f"{API}/numbers/{n['id']}")).json()
if s["status"] == "received":
return await update.message.reply_text(f"Code: {s['sms'][0]['code']}")
if s["status"] in ("canceled", "expired"):
return await update.message.reply_text("No SMS arrived; the charge was refunded.")
await asyncio.sleep(4)
app = ApplicationBuilder().token(os.environ["BOT_TOKEN"]).build()
app.add_handler(CommandHandler("code", code))
app.run_polling()Before you launch
- Charge users from your own balance table before calling the API.
- Store number ids so users can cancel after 2 minutes.
- Rate-limit commands per user and log every order.
- Explain refunds: numbers without an SMS are refunded automatically.
Rules
Use the API only for your own legitimate accounts or apps you're authorized to test, and make sure your customers follow the same Acceptable Use Policy.
Frequently asked questions
Can the bot accept crypto?
That's up to your bot. Your own Noir SMS balance can be topped up with USDC or SOL.
How many users can it handle?
Mind the 120 requests per minute limit per key; webhooks help a lot.
Services in this guide
Keep reading
Building an SMS verification panel on the Noir SMS API
How to build your own SMS verification panel or reseller site on the Noir SMS API: architecture, database, webhooks, pricing and abuse rules.
Read the guide →DevelopersAutomate receiving SMS codes: polling or webhooks
Two ways to receive SMS verification codes automatically with the Noir SMS API: polling GET /numbers/{id} or a signed sms.received webhook. Code included.
Read the guide →DevelopersReceive SMS verification codes with Python
Buy a temporary number and read the SMS verification code from Python with the Noir SMS REST API. Full example with requests, polling and errors.
Read the guide →DevelopersUsing virtual numbers to test SMS flows
How QA teams use real virtual numbers to test SMS sign-up and OTP flows end to end, when to use them vs test numbers, and how to automate with an API.
Read the guide →DevelopersReceive SMS verification codes with Node.js
Buy a temporary number and read SMS verification codes from Node.js with fetch and the Noir SMS REST API. Complete example with error handling.
Read the guide →DevelopersReceive SMS verification codes with PHP
Use PHP and cURL to buy a temporary number and read the SMS verification code with the Noir SMS API. Copy-paste example for panels and scripts.
Read the guide →