Python
Set up your Telemetree Python SDK
Getting started
System Requirements
- pip package manager
- Python 3.7+
- A Telegram bot project set up with Python
Installation
Install Telemetree Python SDK using pip
This will add the Telemetree Python SDK to your current developer environment and you’re ready to proceed to the next steps of configuration and event tracking.
Initialization
To being using the Telemetree Python SDK in your application, you’ll need to initialize it with your project’s specific configuration. Initialization is a crucial step that allows the SDK to start capturing and sending analytics data.
Step-by-Step Initialization
- Import the Telemetree SDK:
- Initialize the SDK with your project ID and API key.
- Connect the client to your webhook.
After wrapping your root component with TwaAnalyticsProvider
, the SDK will automatically start capturing data based on your configuration.
Event Tracking
Alternatively, you can pass on the Telegram Update dictionary directly
Configuration
The Telemetree Python SDK provides some configuration options that you can customize:
auto_capture_telegram
: Enables or disables automatic capturing of Telegram events (default:True
)auto_capture_telegram_events
: Specifies the types of Telegram events to capture automatically (default:["message"]
)auto_capture_commands
: Specifies the Telegram commands to capture automatically (default:["/start", "/help"]
)
Other configuration options include the Telemetree API endpoint, encryption keys, and logging settings. You can modify these options either within the Telemetree dashboard or by updating the config.py
file in the SDK.