RocketChat / Rocket.Chat.Apps-engine

The Rocket.Chat Apps engine and definitions.

Home Page:https://rocketchat.github.io/Rocket.Chat.Apps-engine/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The getBlockBuilder method is deprecated

vorontsoved opened this issue · comments

The getBlockBuilder method is deprecated, with which I can now build blocks and display it in a modal window

export class MyApp extends App implements IUIKitInteractionHandler {
    public async executeActionButtonHandler(
        context: UIKitActionButtonInteractionContext,
        read: IRead,
        http: IHttp,
        persistence: IPersistence,
        modify: IModify
    ): Promise<IUIKitResponse> {
        const { 
            buttonContext, 
            actionId, 
            triggerId, 
            user, 
            room, 
            message,
        } = context.getInteractionData();

        // If you have multiple action buttons, use `actionId` to determine 
        // which one the user interacted with
       
        const blockBuilder = modify.getCreator().getBlockBuilder();
    
    return context.getInteractionResponder().openModalViewResponse({
        title: blockBuilder.newPlainTextObject('Interaction received'),
        blocks: blockBuilder.addSectionBlock({
            text: blockBuilder.newPlainTextObject('We received your interaction, thanks!')
        }).getBlocks(),
    });

        return context.getInteractionResponder().successResponse();
    }
}

how i can do it now