telegramsjs
    Preparing search index...

    Class BusinessConnection

    Hierarchy (View Summary)

    • Base
      • BusinessConnection
    Index

    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

    permissions?: BusinessPermissions

    Permissions of the business bot

    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

    • Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right.

      Parameters

      • ownedGiftId: string

        Unique identifier of the regular gift that should be converted to Telegram Stars.

      Returns Promise<true>

      Returns True on success.

    • Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right.

      Parameters

      • OptionalisPublic: boolean

        Pass True to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo.

      Returns Promise<true>

      Returns True on success.

    • Delete messages on behalf of a business account. Requires the can_delete_outgoing_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message.

      Parameters

      • messageIds: (string | number)[]

        A list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See deleteMessage for limitations on which messages can be deleted.

      Returns Promise<true>

      Returns True on success.

    • Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right.

      Parameters

      • Optionaloptions: Omit<
            {
                businessConnectionId: string;
                excludeLimited?: boolean;
                excludeSaved?: boolean;
                excludeUnique?: boolean;
                excludeUnlimited?: boolean;
                excludeUnsaved?: boolean;
                limit?: number;
                offset?: string;
                sortByPrice?: boolean;
            },
            "businessConnectionId",
        >

        out parameters.

      Returns Promise<OwnedGifts>

      Returns OwnedGifts on success.

    • Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right.

      Returns Promise<StarAmount>

      Returns StarAmount on success.

    • Gifts a Telegram Premium subscription to the given user.

      Parameters

      • monthCount: 3 | 6 | 12

        Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12.

      • starCount: 1000 | 1500 | 2500

        Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months.

      • Optionaloptions: Omit<
            {
                monthCount: 3
                | 6
                | 12;
                starCount: 1000 | 1500 | 2500;
                text?: string;
                textEntities?: MessageEntity[];
                textParseMode?: ParseMode;
                userId: string | number;
            },
            "userId"
            | "monthCount"
            | "starCount",
        >

        out parameters.

      Returns Promise<true>

      Returns True on success.

    • Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right.

      Parameters

      • content: InputStoryContent

        Content of the story.

      • activePeriod: number

        Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400.

      • Optionaloptions: Omit<
            {
                activePeriod: number;
                areas?: StoryArea[];
                businessConnectionId: string;
                caption?: string;
                captionEntities?: MessageEntity[];
                content: InputStoryContent;
                parseMode?: ParseMode;
                postToChatPage?: boolean;
                protectContent?: boolean;
            },
            "businessConnectionId"
            | "content"
            | "activePeriod",
        >

        out parameters.

      Returns Promise<Story>

      Returns Story on success.

    • Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right.

      Parameters

      • messageId: string | number

        Unique identifier of the message to mark as read.

      • OptionalchatId: string | number

        Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours.

      Returns Promise<true>

      Returns True on success.

    • Removes verification from a user who is currently verified on behalf of the organization represented by the bot.

      Returns Promise<true>

      Returns True on success.

    • 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;
                directMessagesTopicId?: number;
                disableNotification?: boolean;
                entities?: MessageEntity[];
                linkPreviewOptions?: LinkPreviewOptions;
                messageEffectId?: string;
                messageThreadId?: string | number;
                parseMode?: ParseMode;
                protectContent?: boolean;
                replyMarkup?:
                    | InlineKeyboardMarkup
                    | ForceReply
                    | ReplyKeyboardMarkup
                    | ReplyKeyboardRemove;
                replyParameters?: ReplyParameters;
                suggestedPostParameters?: SuggestedPostParameters;
                text: string;
            },
            "text"
            | "chatId",
        >

        out parameters

      Returns Promise<Message & { content: string }>

      On success, the sent Message is returned.

    • Use this method to send text messages.

      Parameters

      • text: Omit<
            {
                businessConnectionId?: string;
                chatId: number
                | string;
                directMessagesTopicId?: number;
                disableNotification?: boolean;
                media: ReadonlyArray<
                    | InputMediaAudio
                    | InputMediaDocument
                    | InputMediaPhoto
                    | InputMediaVideo,
                >;
                messageEffectId?: string;
                messageThreadId?: string
                | number;
                protectContent?: boolean;
                replyParameters?: ReplyParameters;
                suggestedPostParameters?: SuggestedPostParameters;
            },
            "chatId",
        >

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

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

      On success, the sent Message is returned.

    • Use this method to send text messages.

      Parameters

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

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

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

        out parameters

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

      On success, the sent Message is returned.

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

      Parameters

      • giftId: string

        Identifier of the gift.

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

        out parameters.

      Returns Promise<true>

      Returns True on success.

    • Changes the bio of a managed business account. Requires the can_change_bio business bot right.

      Parameters

      • Optionalbio: string

        The new value of the bio for the business account; 0-140 characters.

      Returns Promise<true>

      Returns True on success.

    • Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right.

      Parameters

      • showGiftButton: boolean

        Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field.

      • acceptedGiftTypes: AcceptedGiftTypes

        Types of gifts accepted by the business account Returns True on success.

      Returns Promise<true>

    • Changes the first and last name of a managed business account. Requires the can_change_name business bot right. Returns True on success.

      Parameters

      • firstName: string

        The new value of the first name for the business account; 1-64 characters.

      • OptionallastName: string

        The new value of the last name for the business account; 0-64 characters.

      Returns Promise<true>

      Returns True on success.

    • Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right.

      Parameters

      • photo: InputProfilePhoto

        The new profile photo to set.

      • OptionalisPublic: boolean

        Pass True to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo.

      Returns Promise<true>

      Returns True on success.

    • Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True on success.

      Parameters

      • Optionalusername: string

        The new value of the username for the business account; 0-32 characters.

      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.

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

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

      Returns Record<string, any>

      Flattened object.

    • Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right.

      Parameters

      • starCount: number

        Number of Telegram Stars to transfer; 1-10000.

      Returns Promise<true>

      Returns True on success.

    • Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid.

      Parameters

      • options: Omit<MethodParameters["transferGift"], "businessConnectionId">

        out parameters.

      Returns Promise<true>

      Returns True on success.

    • Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid.

      Parameters

      • ownedGiftId: string

        Unique identifier of the regular gift that should be upgraded to a unique one.

      • Optionaloptions: Omit<
            {
                businessConnectionId: string;
                keepOriginalDetails?: boolean;
                ownedGiftId: string;
                sttrCount?: number;
            },
            "businessConnectionId"
            | "ownedGiftId",
        >

        out parameters.

      Returns Promise<true>

      Returns True on success.

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

      Returns string | null

    • Verifies a user on behalf of the organization which is represented by the bot.

      Parameters

      • Optionaldescription: string

        Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.

      Returns Promise<true>

      Returns True on success.