Class BusinessConnection

Hierarchy (view full)

  • Base
    • BusinessConnection

Constructors

Properties

createdUnixTime: number

Date the connection was established in Unix time

enabled: boolean

True, if the connection is active

id: string

Unique identifier of the business connection

replyed: boolean

True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours

user: User

Business account user that created the business connection

userChatId: string

Identifier of a private chat with the user who created the business connection

Accessors

  • get createdAt(): Date
  • Date the connection was established

    Returns Date

  • get createdTimestamp(): number
  • Return the timestamp connection was established, in milliseconds

    Returns number

Methods

  • Protected

    Creates a clone of the current instance

    Returns Base

    A clone of the current instance

  • Protected

    Patches the current instance with new data

    Parameters

    • data: Record<string, any>

      The data to patch the instance with

    Returns Record<string, any>

    The patched data

  • Protected

    Updates the current instance with new data and returns a clone of the updated instance

    Parameters

    • data: Record<string, any>

      The data to update the instance with

    Returns Base

    A clone of the updated instance

  • Stores a message that can be sent by a user of a Mini App.

    Parameters

    • result: InlineQueryResult

      An object describing the message to be sent.

    • Optionaloptions: Omit<{
          allowBotChats?: boolean;
          allowChannelChats?: boolean;
          allowGroupChats?: boolean;
          allowUserChats?: boolean;
          result: InlineQueryResult;
          userId: string | number;
      }, "userId" | "result">

      out parameters.

    Returns Promise<PreparedInlineMessage>

    Returns a PreparedInlineMessage object.

  • Use this method to send text messages.

    Parameters

    • text: string

      Text of the message to be sent, 1-4096 characters after entities parsing and media group options

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          entities?: MessageEntity[];
          linkPreviewOptions?: LinkPreviewOptions;
          messageEffectId?: string;
          messageThreadId?: string | number;
          parseMode?: ParseMode;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          text: string;
      }, "text" | "chatId">

      out parameters

    Returns Promise<Message & {
        content: string;
    }>

    On success, the sent Message is returned.

  • Parameters

    • text: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          media: readonly (
              | InputMediaAudio
              | InputMediaDocument
              | InputMediaPhoto
              | InputMediaVideo)[];
          messageEffectId?: string;
          messageThreadId?: string | number;
          protectContent?: boolean;
          replyParameters?: ReplyParameters;
      }, "chatId">

    Returns Promise<(
        | Message & {
            audio: Audio;
        }
        | Message & {
            document: Document;
        }
        | Message & {
            photo: Photo;
        }
        | Message & {
            video: Video;
        })[]>

  • Parameters

    • text: string | Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          media: readonly (
              | InputMediaAudio
              | InputMediaDocument
              | InputMediaPhoto
              | InputMediaVideo)[];
          messageEffectId?: string;
          messageThreadId?: string | number;
          protectContent?: boolean;
          replyParameters?: ReplyParameters;
      }, "chatId">
    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          entities?: MessageEntity[];
          linkPreviewOptions?: LinkPreviewOptions;
          messageEffectId?: string;
          messageThreadId?: string | number;
          parseMode?: ParseMode;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          text: string;
      }, "text" | "chatId">

    Returns Promise<Message & {
        content: string;
    } | (
        | Message & {
            audio: Audio;
        }
        | Message & {
            document: Document;
        }
        | Message & {
            photo: Photo;
        }
        | Message & {
            video: Video;
        })[]>

  • Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user.

    Parameters

    • giftId: string

      Identifier of the gift.

    • Optionaloptions: Omit<{
          giftId: string;
          text?: string;
          textEntities?: MessageEntity[];
          textParseMode?: ParseMode;
          userId: string | number;
      }, "giftId" | "userId">

      out parameters.

    Returns Promise<true>

    Returns True on success.

  • Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess.

    Parameters

    • Optionaloptions: {
          emojiStatusCustomEmojiId?: string;
          emojiStatusExpirationDate?: number;
      }

      out parameters.

      • OptionalemojiStatusCustomEmojiId?: string

        Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.

      • OptionalemojiStatusExpirationDate?: number

        Expiration date of the emoji status, if any

    Returns Promise<true>

    Returns True on success.

  • Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars.

    Parameters

    • telegramPaymentChargeId: string

      Telegram payment identifier for the subscription.

    • isCanceled: boolean

      Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.

    Returns Promise<true>

    Returns True on success.

  • Flatten an object. Any properties that are collections will get converted to an array of keys.

    Parameters

    • OptionalpropsRecursive: boolean

      Optional. If true, calls toJSON method on nested objects.

    • Rest...props: Record<string, string | boolean>[]

      Optional. Specific properties to include/exclude, or rename.

    Returns Record<string, any>

    Flattened object.

  • Returns the id instance Chat, User, ChatMember and other

    Returns null | string