I can find links pointing to UI Kit pages but they are all 404. I am trying to add some action buttons to livechat but all the docs seem to have gone.
For example:
https://developer.rocket.chat/apps-engine/adding-features/uikit/action-buttons
I can find links pointing to UI Kit pages but they are all 404. I am trying to add some action buttons to livechat but all the docs seem to have gone.
For example:
https://developer.rocket.chat/apps-engine/adding-features/uikit/action-buttons
Dear @DigitalReach ,
Sorry to hear that, we’ve got some recent changes in our documentation structure.
If you’re looking for documentation on action buttons, I wanted to let you know that I found a great resource that I think you’ll find valuable. You can access it at the following link: ui/UIActionButtonContext | Rocket.Chat Apps TypeScript Definition
And here is a snippet as an example to use the action button:
// In your main class
protected async extendConfiguration(configuration: IConfigurationExtend): Promise<void> {
await configuration.ui.registerButton({
actionId: 'SomeCoolActionId',
labelI18n: 'i18n_label',
context: UIActionButtonContext.ROOM_ACTION,
}),
}
And to deal with the click action:
// main class
public async executeActionButtonHandler(
context: UIKitActionButtonInteractionContext,
read: IRead,
http: IHttp,
persistence: IPersistence,
modify: IModify,
): Promise<IUIKitResponse> {
try {
const { user, triggerId, actionId } = context.getInteractionData();
switch (actionId) {
case 'SomeCoolActionId':
//Some code
return context.getInteractionResponder().successResponse();
}
return { success: true };
} catch (error) {
return { success: false };
}
}
I hope this helps you.