VOOZH about

URL: https://dev.to/tellabot_sms/python-sdk-for-tell-a-bot-api-automate-your-sms-verification-2c3f

⇱ Python SDK for Tell A Bot API: Automate Your SMS Verification - DEV Community


If you've ever built a bot, scraper, or testing pipeline that needs to verify a phone number, you know the pain: SIM cards, forwarding services, juggling multiple numbers manually. Tell A Bot solves this — it gives you temporary US phone numbers on demand, receives the SMS, and hands you back the OTP code. All via API.

We just published a Python SDK on GitHub, so I wanted to walk through what it looks like in practice.

What is Tell A Bot?

Tell A Bot is a service for receiving SMS online using temporary US phone numbers. You request a number for one of 700+ supported services, the number waits for an incoming SMS, and once it arrives you read the message and the extracted PIN code through the API.

Common use cases:

  • Automating account registration or verification flows in tests
  • Receiving OTP codes in scripts without a physical SIM
  • Spinning up multiple accounts for a service during development

Installation

pip install get-sms-online

Or directly from GitHub:

pip install git+https://github.com/getsms-online/get.sms.online-python.git

Generate your API key at Account → Profile in Tell A Bot's members area.

The simplest case — request a number and wait for the code

from getsms import GetSMSClient, GetSMSError

client = GetSMSClient(user="your_username", api_key="your_api_key")

# Check your balance first
print(f"Balance: ${client.balance()}")

# Request a number for WhatsApp and wait for the SMS
requests = client.request_number("WhatsApp")
req = requests[0]
print(f"Your number: +{req['mdn']}")

sms = client.wait_for_sms(req["id"], timeout=900)
if sms:
 print(f"SMS: {sms['reply']}")
 print(f"Code: {sms['pin']}")
else:
 print("No SMS received in time")

wait_for_sms polls the API every 15 seconds (the recommended minimum) and returns the message once an SMS arrives, or None on timeout.

Error handling

from getsms import GetSMSClient, GetSMSError

client = GetSMSClient(user="your_username", api_key="your_api_key")

try:
 requests = client.request_number("Google")
 req = requests[0]

 sms = client.wait_for_sms(req["id"])
 if sms:
 print(f"Got code: {sms['pin']}")
 else:
 print("Timed out — no SMS received")

except GetSMSError as e:
 # API-level errors: invalid service name, no numbers available, etc.
 print(f"API error: {e}")
except Exception as e:
 # Network errors
 print(f"Request failed: {e}")

Reject a number you don't want

If the assigned number looks wrong or you want to skip it, reject it — it won't be offered to you again:

requests = client.request_number("Telegram")
req = requests[0]

if req["mdn"].startswith("1212"):
 client.reject(req["id"]) # NYC numbers blocked by the service? Skip it.

Webhooks instead of polling

If you're handling volume, configure a webhook URL at Account → Profile. Tell A Bot will POST to your endpoint the moment an SMS arrives, with fields including event, id, reply, pin, and price. No polling loop needed.

Check available services and pricing

# All services
services = client.list_services()
for s in services:
 print(f"{s['name']}: ${s['price']} ({s['otp_available']} available)")

# Single service — also returns recommended_markup for priority bidding
info = client.list_services("Google")
print(info[0]["recommended_markup"])

Links