Files
FragmentAPI/docs/client/ads.md
T

1019 B

Ads

Ads methods cover two different actions:

  • sending TON to a user,
  • recharging your own Telegram Ads account.

topup_ton

await client.topup_ton(
    username: str,
    amount: int,
    show_sender: bool = True,
) -> AdsTopupResult

Rules:

  • username: recipient Telegram username
  • amount: integer from 1 to 1_000_000_000
  • show_sender: sender visibility

Important: amount must be an integer in allowed range.

recharge_ads

await client.recharge_ads(
    account: str,
    amount: int,
) -> AdsRechargeResult

Rules:

  • account: channel/bot username linked to your ads account
  • amount: integer from 1 to 1_000_000_000

Returns

  • AdsTopupResult(transaction_id, username, amount)
  • AdsRechargeResult(transaction_id, amount)

Common errors

  • ConfigurationError
  • UserNotFoundError (topup recipient)
  • WalletError
  • VerificationError