ptgb
A complete Telegram Bot API client for Dart

Invite Links & Join Requests

Part of the API Reference.

Future<String> exportChatInviteLink(Object chatId) async =>

Generates a new primary invite link for the chat, invalidating the previous one.

Future<Json> createChatInviteLink(
    Object chatId, {
    String? name,
    int? expireDate,
    int? memberLimit,
    bool? createsJoinRequest,
  }) async =>

Creates an additional (non-primary) invite link, optionally limited by [expireDate], [memberLimit], or requiring admin approval via [createsJoinRequest].

Future<Json> editChatInviteLink(
    Object chatId,
    String inviteLink, {
    String? name,
    int? expireDate,
    int? memberLimit,
    bool? createsJoinRequest,
  }) async =>

Edits a previously created non-primary invite link.

Future<Json> revokeChatInviteLink(Object chatId, String inviteLink) async =>

Revokes an invite link so it can no longer be used to join.

Future<Json> createChatSubscriptionInviteLink(
    Object chatId,
    int subscriptionPeriod,
    int subscriptionPrice, {
    String? name,
  }) async =>

Creates a subscription invite link that charges [subscriptionPeriod] / [subscriptionPrice] in Telegram Stars for access to the channel.

Future<Json> editChatSubscriptionInviteLink(
    Object chatId,
    String inviteLink, {
    String? name,
  }) async =>

Edits the name of an existing subscription invite link.

approveChatJoinRequest

Future<bool> approveChatJoinRequest(Object chatId, int userId) async =>

Approves a pending join request for a chat that requires admin approval.

declineChatJoinRequest

Future<bool> declineChatJoinRequest(Object chatId, int userId) async =>

Declines a pending join request.

answerChatJoinRequestQuery

Future<bool> answerChatJoinRequestQuery(
    String chatJoinRequestQueryId,
    String result,
  ) async =>

Answers a join-request query routed to this bot by a chat that has designated it as a "guard bot" (see ChatFullInfo.guard_bot), resolving the request per [result]: 'approve' to let the user join, 'decline' to reject them, or 'queue' to leave the decision to other administrators.

sendChatJoinRequestWebApp

Future<Json> sendChatJoinRequestWebApp(
    String chatJoinRequestQueryId,
    Json webApp,
  ) async =>

Sends a Web App (Mini App) to a user whose join-request query this bot received as a guard bot — e.g. to collect information before approving them via [answerChatJoinRequestQuery]. [webApp] should be shaped like WebAppInfo (a url field); raw [Json] is used for consistency with [answerWebAppQuery].