telnyx-account-python
npx skills add https://github.com/team-telnyx/telnyx-ext-agent-skills --skill telnyx-account-python
Agent 安装分布
Skill 文档
Telnyx Account – Python
Installation
pip install telnyx
Setup
import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
All examples below assume client is already initialized as shown above.
List Audit Logs
Retrieve a list of audit log entries.
GET /audit_events
page = client.audit_events.list()
page = page.data[0]
print(page.id)
Get user balance details
GET /balance
balance = client.balance.retrieve()
print(balance.data)
Search detail records
Search for any detail record across the Telnyx Platform
GET /detail_records
page = client.detail_records.list()
page = page.data[0]
print(page)
List invoices
Retrieve a paginated list of invoices.
GET /invoices
page = client.invoices.list()
page = page.data[0]
print(page.file_id)
Get invoice by ID
Retrieve a single invoice by its unique identifier.
GET /invoices/{id}
invoice = client.invoices.retrieve(
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(invoice.data)
List auto recharge preferences
Returns the payment auto recharge preferences.
GET /payments/auto_recharge_prefs
auto_recharge_prefs = client.payment.auto_recharge_prefs.list()
print(auto_recharge_prefs.data)
Update auto recharge preferences
Update payment auto recharge preferences.
PATCH /payments/auto_recharge_prefs
Optional: enabled (boolean), invoice_enabled (boolean), preference (enum), recharge_amount (string), threshold_amount (string)
auto_recharge_pref = client.payment.auto_recharge_prefs.update()
print(auto_recharge_pref.data)
List User Tags
List all user tags.
GET /user_tags
user_tags = client.user_tags.list()
print(user_tags.data)
List webhook deliveries
Lists webhook_deliveries for the authenticated user
GET /webhook_deliveries
page = client.webhook_deliveries.list()
page = page.data[0]
print(page.id)
Find webhook_delivery details by ID
Provides webhook_delivery debug data, such as timestamps, delivery status and attempts.
GET /webhook_deliveries/{id}
webhook_delivery = client.webhook_deliveries.retrieve(
"C9C0797E-901D-4349-A33C-C2C8F31A92C2",
)
print(webhook_delivery.data)