ptgb
A complete Telegram Bot API client for Dart

Telegram Business Accounts

Part of the API Reference.

getBusinessConnection

Future<Json> getBusinessConnection(String businessConnectionId) async =>

Fetches details about a Telegram Business connection by its ID.

setBusinessAccountName

Future<bool> setBusinessAccountName(
    String businessConnectionId,
    String firstName, {
    String? lastName,
  }) async =>

Changes the first/last name on a connected business account.

setBusinessAccountUsername

Future<bool> setBusinessAccountUsername(String businessConnectionId, {String? username}) async =>

Changes the username on a connected business account.

setBusinessAccountBio

Future<bool> setBusinessAccountBio(String businessConnectionId, {String? bio}) async =>

Changes the bio on a connected business account.

setBusinessAccountProfilePhoto

Future<bool> setBusinessAccountProfilePhoto(
    String businessConnectionId,
    InputProfilePhoto photo, {
    bool? isPublic,
  }) async {

Sets the profile photo of a connected business account.

removeBusinessAccountProfilePhoto

Future<bool> removeBusinessAccountProfilePhoto(
    String businessConnectionId, {
    bool? isPublic,
  }) async =>

Removes the profile photo of a connected business account.

setBusinessAccountGiftSettings

Future<bool> setBusinessAccountGiftSettings(
    String businessConnectionId,
    bool showGiftButton,
    AcceptedGiftTypes acceptedGiftTypes,
  ) async =>

Configures which gift types a connected business account accepts, via [acceptedGiftTypes].

getBusinessAccountStarBalance

Future<Json> getBusinessAccountStarBalance(String businessConnectionId) async =>

Returns the Telegram Stars balance of a connected business account.

transferBusinessAccountStars

Future<bool> transferBusinessAccountStars(String businessConnectionId, int starCount) async =>

Transfers Telegram Stars out of a connected business account.

getBusinessAccountGifts

Future<Json> getBusinessAccountGifts(
    String businessConnectionId, {
    bool? excludeUnsaved,
    bool? excludeSaved,
    bool? excludeUnlimited,
    bool? excludeLimitedUpgradable,
    bool? excludeLimitedNonUpgradable,
    bool? excludeUnique,
    bool? sortByPrice,
    String? offset,
    int? limit,
  }) async =>

Lists gifts owned by a connected business account.

convertGiftToStars

Future<bool> convertGiftToStars(String businessConnectionId, String ownedGiftId) async =>

Converts a regular gift owned by a business account into Telegram Stars.

upgradeGift

Future<bool> upgradeGift(
    String businessConnectionId,
    String ownedGiftId, {
    bool? keepOriginalDetails,
    int? starCount,
  }) async =>

Upgrades a regular gift owned by a business account into a unique gift.

transferGift

Future<bool> transferGift(
    String businessConnectionId,
    String ownedGiftId,
    int newOwnerChatId, {
    int? starCount,
  }) async =>

Transfers a unique gift owned by a business account to another owner.

readBusinessMessage

Future<bool> readBusinessMessage(String businessConnectionId, int chatId, int messageId) async =>

Marks a message in a connected business account’s chat as read.

deleteBusinessMessages

Future<bool> deleteBusinessMessages(String businessConnectionId, List<int> messageIds) async =>

Deletes messages on behalf of a connected business account.