Skip to main content

twx.botapi

twx.botapi: Unofficial Telegram Bot API Library and Client

- -
contributions Please join https://github.com/datamachine/twx.botapi
issues Please use https://github.com/datamachine/twx.botapi/issues
Python version supported 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6

twx.botapi is a python interface for the Telegram bot API. It supports making synchronous and asynchronous calls and converts the response into a usable native python object.

Support for the MTProto API is in the works, but considered pre-alpha right now.

Support

You can join our support chat at: https://telegram.me/twxapi

Install

For stable:

pip install twx.botapi

For dev:

pip install -i https://testpypi.python.org/pypi twx.botapi

Documentation

Documentation can be found at http://pythonhosted.org/twx.botapi/

Quick Start

from twx.botapi import TelegramBot, ReplyKeyboardMarkup

"""
Setup the bot
"""

bot = TelegramBot('<API TOKEN>')
bot.update_bot_info().wait()
print(bot.username)

"""
Send a message to a user
"""
user_id = int(<someuserid>)

result = bot.send_message(user_id, 'test message body').wait()
print(result)

"""
Get updates sent to the bot
"""
updates = bot.get_updates().wait()
for update in updates:
    print(update)

"""
Use a custom keyboard
"""
keyboard = [
    ['7', '8', '9'],
    ['4', '5', '6'],
    ['1', '2', '3'],
            ['0']
]
reply_markup = ReplyKeyboardMarkup.create(keyboard)

bot.send_message(user_id, 'please enter a number', reply_markup=reply_markup).wait()

Metadata

Release files for twx.botapi 3.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for twx.botapi 3.6.2
File Size Uploaded Provenance Actions
twx.botapi-3.6.2.tar.gz 33.8 kB Without provenance Details for twx.botapi-3.6.2.tar.gz

Release files / twx.botapi-3.6.2.tar.gz

Download URL twx.botapi-3.6.2.tar.gz
Size 33.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7a9a57e93789a9b5075173146b69b9a07cac55347485c94499186f361ab401b4
BLAKE2b-256 checksum
How to use checksums
93e8722bc8acd0732019ad879fc5427d07746abb4115001316b91576661e463e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for twx.botapi 3.6.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page