telebot-ts API Documentation - v1.0.0
    Preparing search index...

    Class BusinessMessagesHandler<C, R>

    Handler for messages in connected Telegram Business accounts.

    Catches business_message, edited_business_message, and deleted_business_messages.

    const handler = new BusinessMessagesHandler(async (update, context) => {
    if (update.business_message) {
    console.log("New business message received:", update.business_message.text);
    }
    });

    Type Parameters

    Hierarchy (View Summary)

    Index
    • Creates a new handler instance.

      Type Parameters

      • C extends CallbackContext<
            Record<string, unknown>,
            Record<string, unknown>,
            Record<string, unknown>,
        > = CallbackContext<
            Record<string, unknown>,
            Record<string, unknown>,
            Record<string, unknown>,
        >

        Type of the callback context.

      • R = unknown

        Return value type.

      Parameters

      • callback: HandlerCallback<C, R>

        Async function executed when this handler matches an update.

      Returns BusinessMessagesHandler<C, R>

    callback: HandlerCallback<C, R>

    The underlying callback function to invoke on match.

    • Checks whether the incoming update is a business message event.

      Parameters

      • update: Update

        The update to test.

      Returns Promise<boolean>

      true if update is a business message event.

    • Executes the registered handler callback with the given update and context.

      Parameters

      • update: Update

        The Telegram update to process.

      • context: C

        Callback context instance.

      Returns Promise<R>

      The value returned by the callback function.