### Make Basic GET Request with IHttp Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt This example shows how to perform a basic GET request to an external API using the IHttp accessor. It includes setting headers and query parameters. ```typescript import { IHttp, IHttpRequest, IHttpResponse } from '@rocket.chat/apps-engine/definition/accessors'; // Basic GET request const response = await http.get('https://api.example.com/users', { headers: { 'Authorization': 'Bearer your-token' }, params: { page: '1', limit: '10' } }); if (response.statusCode === 200) { const users = response.data; } ``` -------------------------------- ### API Example Decorator Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/functions/api_IApiExample.example.html The 'example' decorator is used to describe API examples. It takes an options object of type IApiExample. ```APIDOC ## Function example ### Description Decorator to describe api examples ### Method Decorator ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ### Details #### Parameters - **options** (IApiExample) - Required - Options for the API example decorator. #### Returns ((target, propertyKey, descriptor) => void) - A function that returns void. ##### target: any ##### propertyKey: string ##### descriptor: PropertyDescriptor ``` -------------------------------- ### Configure Request Timeout and SSL Options with IHttp Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt This example demonstrates how to configure request-specific options like timeout and SSL verification for an HTTP GET request. ```typescript // Request with timeout and SSL options const secureResponse = await http.get('https://internal-api.company.com/data', { timeout: 5000, // 5 seconds strictSSL: true, rejectUnauthorized: true }); ``` -------------------------------- ### Slash Command Previewer Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/slashcommands_ISlashCommand.ISlashCommand.html The `previewer` function is called when a user starts typing a command and the `providesPreview` setting is true. It returns a list of preview items to be displayed to the user. A maximum of 10 items will be returned. ```APIDOC ## previewer ### Description The function which gets called whenever a user starts typing the command and the `providesPreview` is set to true. Max amount returned to the client is 10 and no more, period. ### Parameters * ##### context: [SlashCommandContext](../classes/slashcommands_SlashCommandContext.SlashCommandContext.html) * ##### read: [IRead](accessors_IRead.IRead.html) * ##### modify: [IModify](accessors_IModify.IModify.html) * ##### http: [IHttp](accessors_IHttp.IHttp.html) * ##### persis: [IPersistence](accessors_IPersistence.IPersistence.html) ### Returns Promise<[ISlashCommandPreview](slashcommands_ISlashCommandPreview.ISlashCommandPreview.html)> ``` -------------------------------- ### App Class Constructor Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/classes/App.App.html The constructor for the App class. It's called when the server initializes apps. Developers should use the `initialize()` method for setup instead of the constructor. ```APIDOC ## constructor App ### Description * `new App(info, logger, accessors?)` * Create a new App, this is called whenever the server starts up and initiates the Apps. Note, your implementation of this class should call `super(name, id, version)` so we have it. Also, please use the `initialize()` method to do items instead of the constructor as the constructor _might_ be called more than once but the `initialize()` will only be called once. ### Parameters #### Path Parameters - **info** (IAppInfo) - Description of the info parameter. - **logger** (ILogger) - Description of the logger parameter. - **accessors** (IAppAccessors) - Optional. Description of the accessors parameter. ### Returns * App ### Defined in * src/definition/App.ts:31 ``` -------------------------------- ### Integrate Local Apps-Engine with Rocket.Chat Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/README.md After setting up a local Rocket.Chat server, navigate to its directory and install your local Apps-Engine using its path. This ensures Rocket.Chat uses your local version. ```sh meteor npm install PATH_TO_APPS_ENGINE ``` -------------------------------- ### App Lifecycle Methods in TypeScript Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt Extend the `App` class to implement lifecycle methods for managing your Rocket.Chat App. Use `initialize` for setup, `onEnable` and `onDisable` for state changes, and `onInstall`/`onUninstall` for setup/cleanup. The `onEnable` method can return `false` to prevent the App from being enabled if prerequisites are not met. ```typescript import { IAppAccessors, IConfigurationExtend, IConfigurationModify, IEnvironmentRead, IHttp, ILogger, IModify, IPersistence, IRead, } from '@rocket.chat/apps-engine/definition/accessors'; import { App } from '@rocket.chat/apps-engine/definition/App'; import { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata'; export class MyApp extends App { constructor(info: IAppInfo, logger: ILogger, accessors: IAppAccessors) { super(info, logger, accessors); } // Called during App initialization - register settings, commands, endpoints here public async initialize( configurationExtend: IConfigurationExtend, environmentRead: IEnvironmentRead ): Promise { await this.extendConfiguration(configurationExtend, environmentRead); } // Called when the App is enabled - return false to prevent enabling public async onEnable( environment: IEnvironmentRead, configurationModify: IConfigurationModify ): Promise { const apiKey = await environment.getSettings().getValueById('api-key'); if (!apiKey) { this.getLogger().error('API key not configured'); return false; // Prevent app from enabling } return true; } // Called when the App is disabled public async onDisable(configurationModify: IConfigurationModify): Promise { this.getLogger().info('App has been disabled'); } // Called once when the App is installed public async onInstall( context: IAppInstallationContext, read: IRead, http: IHttp, persistence: IPersistence, modify: IModify ): Promise { this.getLogger().info(`App installed by ${context.user.username}`); } // Called once when the App is uninstalled public async onUninstall( context: IAppUninstallationContext, read: IRead, http: IHttp, persistence: IPersistence, modify: IModify ): Promise { this.getLogger().info('App uninstalled, cleaning up...'); } } ``` -------------------------------- ### Settings Module Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/modules/uploads_StoreType.html APIs for managing app and system settings. ```APIDOC ## Settings Module ### Description Provides interfaces for accessing and modifying application and system settings. ### Endpoint `/settings`, `/settings/ISetting`, `/settings/ISettingUpdateContext`, `/settings/SettingType` ### Parameters This section is not applicable as these refer to module and interface definitions. ``` -------------------------------- ### GET /api/v1/apps/:appId/public Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/api_IApiEndpoint.IApiEndpoint.html Handles GET requests to a publically accessible URL for an App. This method is called when the publically accessible URL for this App is invoked via a GET request. ```APIDOC ## GET /api/v1/apps/:appId/public ### Description Handles GET requests to a publically accessible URL for an App. This method is called when the publically accessible URL for this App is invoked via a GET request. ### Method GET ### Endpoint /api/v1/apps/:appId/public ### Parameters #### Path Parameters - **appId** (string) - Required - The unique identifier of the App. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **IApiResponse** (Array) - An array of API responses. #### Response Example None ``` -------------------------------- ### UI Kit Blocks Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/messages_IPostMessageStarred.IPostMessageStarred.html Documentation for building UI elements using blocks in the UI Kit. ```APIDOC ## UI Kit Blocks ### Description Provides interfaces and builders for creating UI elements using blocks within the UI Kit. ### Modules - `uikit/blocks`: Main module for UI Kit blocks. - `uikit/blocks/BlockBuilder`: Builder for constructing block elements. - `uikit/blocks/Blocks`: Core block elements. - `uikit/blocks/Elements`: UI elements within blocks. - `uikit/blocks/Objects`: General objects used in blocks. ``` -------------------------------- ### Troubleshoot ENOENT Error During Installation Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/README.md For ENOENT errors during `meteor npm install PATH_TO_APPS_ENGINE`, remove the existing Apps-Engine module, reinstall it in its own directory, and then reinstall it into the Rocket.Chat project. ```sh rm -rf node_modules/@rocket.chat/apps-engine cd PATH_TO_APP_ENGINE npm install cd PATH_TO_ROCKETCHAT meteor npm install ../Rocket.Chat.Apps-engine ``` -------------------------------- ### UI Kit Blocks Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/messages_IMessageFile.IMessageFile.html Documentation for building and composing UI elements using blocks. ```APIDOC ## UI Kit Blocks ### Description Provides interfaces and classes for constructing complex UI layouts using a block-based system. ### Modules - `uikit/blocks/BlockBuilder`: Builder for creating UI blocks. - `uikit/blocks/Blocks`: Core block definitions. - `uikit/blocks/Elements`: UI elements that can be used within blocks. - `uikit/blocks/Objects`: Common objects used in block construction. ``` -------------------------------- ### startRoom Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IModifyCreator.IModifyCreator.html Starts the process for building a new room. ```APIDOC ## POST /api/v1/apps/room ### Description Starts the process for building a new room. ### Method POST ### Endpoint /api/v1/apps/room ### Parameters #### Request Body - **data** (IRoom) - Optional - The initial data to pass into the builder. The `id` property will be ignored. ### Response #### Success Response (200) - **IRoomBuilder** (object) - An IRoomBuilder instance. ``` -------------------------------- ### startDiscussion Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IModifyCreator.IModifyCreator.html Starts the process for building a new discussion. ```APIDOC ## POST /api/v1/apps/discussion ### Description Starts the process for building a new discussion. ### Method POST ### Endpoint /api/v1/apps/discussion ### Parameters #### Request Body - **data** (Partial) - Optional - The initial data to pass into the builder. The `id` property will be ignored. ### Response #### Success Response (200) - **IDiscussionBuilder** (object) - An IDiscussionBuilder instance. ``` -------------------------------- ### startVideoConference Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IModifyCreator.IModifyCreator.html Starts the process for building a new video conference. ```APIDOC ## POST /api/v1/apps/video-conference ### Description Starts the process for building a new video conference. ### Method POST ### Endpoint /api/v1/apps/video-conference ### Parameters #### Request Body - **data** (Partial) - Optional - The initial data to pass into the builder. ### Response #### Success Response (200) - **IVideoConferenceBuilder** (object) - An IVideoConferenceBuilder instance. ``` -------------------------------- ### UI Kit Blocks and Elements Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/modules/uikit.html Documentation for building blocks and elements within the UI Kit, including BlockBuilder and various element types. ```APIDOC ## UI Kit Blocks and Elements ### Description Documentation for building blocks and elements within the UI Kit, including BlockBuilder and various element types. ### Endpoints This section does not define specific API endpoints but rather interfaces and classes for building UI elements. ### Components * `uikit/blocks/BlockBuilder` * `uikit/blocks/Blocks` * `uikit/blocks/Elements` * `uikit/blocks/Objects` ### Related Interfaces * `ui/IUIActionButtonDescriptor` * `ui/UIActionButtonContext` * `uikit/AccessoryElements` * `uikit/BlockBuilder` * `uikit/BlockElementType` * `uikit/BlockType` * `uikit/ButtonStyle` * `uikit/ConditionalBlockFiltersEngine` * `uikit/IActionsBlock` * `uikit/IBlock` * `uikit/IBlockElement` * `uikit/IButtonElement` * `uikit/IConditionalBlock` * `uikit/IConditionalBlockFilters` * `uikit/IContextBlock` * `uikit/IDividerBlock` * `uikit/IImageBlock` * `uikit/IImageElement` * `uikit/IInputBlock` * `uikit/IInputElement` * `uikit/IInteractiveElement` * `uikit/IMultiStaticSelectElement` * `uikit/IOptionObject` * `uikit/IOverflowMenuElement` * `uikit/IPlainTextInputElement` * `uikit/ISectionBlock` * `uikit/ISelectElement` * `uikit/IStaticSelectElement` * `uikit/ITextObject` * `uikit/IUIKitContextualBarInteraction` * `uikit/IUIKitContextualBarResponse` * `uikit/IUIKitErrorInteraction` * `uikit/IUIKitErrorResponse` * `uikit/IUIKitIncomingInteraction` * `uikit/IUIKitInteraction` * `uikit/IUIKitInteractionHandler` * `uikit/IUIKitLivechatBaseIncomingInteraction` * `uikit/IUIKitLivechatBlockIncomingInteraction` * `uikit/IUIKitLivechatIncomingInteraction` * `uikit/IUIKitLivechatInteractionHandler` * `uikit/IUIKitModalInteraction` * `uikit/IUIKitModalResponse` * `uikit/IUIKitResponse` * `uikit/IUIKitSurface` * `uikit/InputElementDispatchAction` * `uikit/TextObjectType` * `uikit/UIKitActionButtonInteractionContext` * `uikit/UIKitBlockInteractionContext` * `uikit/UIKitIncomingInteraction` * `uikit/UIKitIncomingInteractionType` * `uikit/UIKitInteractionContext` * `uikit/UIKitInteractionType` * `uikit/UIKitLivechatBlockInteractionContext` * `uikit/UIKitLivechatInteractionContext` * `uikit/UIKitSurfaceType` * `uikit/UIKitViewCloseInteractionContext` * `uikit/UIKitViewSubmitInteractionContext` ``` -------------------------------- ### UIKit Module Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/modules/uploads_StoreType.html APIs for building and managing UI Kits. ```APIDOC ## UIKit Module ### Description Offers comprehensive tools for building interactive user interfaces using UI Kits, including handling incoming interactions and defining views. ### Endpoint `/uikit`, `/uikit/IUIKitActionHandler`, `/uikit/IUIKitIncomingInteraction`, `/uikit/IUIKitIncomingInteractionActionButton`, `/uikit/IUIKitInteractionType`, `/uikit/IUIKitSurface`, `/uikit/IUIKitView`, `/uikit/UIKitIncomingInteractionContainer`, `/uikit/UIKitIncomingInteractionTypes`, `/uikit/UIKitInteractionContext`, `/uikit/UIKitInteractionPayloadFormatter`, `/uikit/UIKitInteractionResponder` ### Parameters This section is not applicable as these refer to module and interface definitions. ``` -------------------------------- ### startMessage Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IModifyCreator.IModifyCreator.html Starts the process for building a new message object. ```APIDOC ## POST /api/v1/apps/message ### Description Starts the process for building a new message object. ### Method POST ### Endpoint /api/v1/apps/message ### Parameters #### Request Body - **data** (IMessage) - Optional - The initial data to pass into the builder. The `id` property will be ignored. ### Response #### Success Response (200) - **IMessageBuilder** (object) - An IMessageBuilder instance. ``` -------------------------------- ### startBotUser Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IModifyCreator.IModifyCreator.html Starts the process for building a new bot user. ```APIDOC ## POST /api/v1/apps/botuser ### Description Starts the process for building a new bot user. ### Method POST ### Endpoint /api/v1/apps/botuser ### Parameters #### Request Body - **data** (Partial) - Optional - The initial data to pass into the builder. The `id` property will be ignored. ### Response #### Success Response (200) - **IUserBuilder** (object) - An IUserBuilder instance. ``` -------------------------------- ### UI Kit Surfaces and Views Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/classes/api_ApiEndpoint.ApiEndpoint.html Documentation for UI Kit surfaces and views, defining how interactive elements are presented to users. ```APIDOC ## UI Kit Surfaces and Views ### Description This section details the interfaces for UI Kit surfaces and views, which are fundamental for creating interactive user experiences within Rocket.Chat applications. ### Modules - `uikit/IUIKitSurface`: Defines the structure for UI surfaces. - `uikit/IUIKitView`: Defines the structure for UI views. - `uikit/UIKitIncomingInteractionContainer`: Handles incoming interactions within a UI container. - `uikit/UIKitIncomingInteractionTypes`: Specifies the types of incoming interactions. - `uikit/UIKitInteractionContext`: Provides context for UI interactions. - `uikit/UIKitInteractionPayloadFormatter`: Formats the payload for UI interactions. - `uikit/UIKitInteractionResponder`: Handles responses to UI interactions. - `uikit/blocks`: Contains definitions for UI blocks. - `uikit/blocks/BlockBuilder`: A builder for creating UI blocks. - `uikit/blocks/Blocks`: General definitions for UI blocks. - `uikit/blocks/Elements`: Definitions for UI block elements. - `uikit/blocks/Objects`: Definitions for UI block objects. ``` -------------------------------- ### startLivechatMessage Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IModifyCreator.IModifyCreator.html Starts the process for building a new livechat message object. ```APIDOC ## POST /api/v1/apps/livechat/message ### Description Starts the process for building a new livechat message object. ### Method POST ### Endpoint /api/v1/apps/livechat/message ### Parameters #### Request Body - **data** (ILivechatMessage) - Optional - The initial data to pass into the builder. The `id` property will be ignored. ### Response #### Success Response (200) - **ILivechatMessageBuilder** (object) - An IMessageBuilder instance. ``` -------------------------------- ### UI Kit Surfaces and Views Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IOAuthAppsModify.IOAuthAppsModify.html Documentation for UI Kit surfaces and views, defining how interactive elements are presented. ```APIDOC ## UI Kit Surfaces and Views ### Description Provides interfaces for defining UI surfaces and views within the Rocket.Chat Apps-Engine. ### Modules - `uikit/IUIKitSurface`: Interface for UI Kit surfaces. - `uikit/IUIKitView`: Interface for UI Kit views. ``` -------------------------------- ### UI Kit Surfaces and Views Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/api_IApiEndpointInfo.IApiEndpointInfo.html Documentation for UI Kit surfaces and views, defining how interactive elements are presented and managed. ```APIDOC ## UI Kit Surfaces and Views ### Description Provides interfaces for defining and managing UI surfaces and views within the Rocket.Chat Apps-Engine. ### Modules - `uikit/IUIKitSurface`: Interface for UI Kit surfaces. - `uikit/IUIKitView`: Interface for UI Kit views. ### Related Modules - `uikit/blocks`: For building UI blocks. - `uikit/blocks/BlockBuilder`: Builder for UI blocks. - `uikit/blocks/Blocks`: Core UI block definitions. - `uikit/blocks/Elements`: UI block elements. - `uikit/blocks/Objects`: UI block objects. ``` -------------------------------- ### IApiExample Interface Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/api_IApiExample.IApiExample.html The IApiExample interface defines the structure for parameters used in API examples. ```APIDOC ## Interface IApiExample Represents the parameters of an api example. ### Properties #### `Optional` params params?: { [key: string]: string; } * Defined in [src/definition/api/IApiExample.ts:5](https://github.com/RocketChat/Rocket.Chat.Apps-engine/blob/master/src/definition/api/IApiExample.ts#L5) #### `Optional` query query?: { [key: string]: string; } * Defined in [src/definition/api/IApiExample.ts:6](https://github.com/RocketChat/Rocket.Chat.Apps-engine/blob/master/src/definition/api/IApiExample.ts#L6) #### `Optional` headers headers?: { [key: string]: string; } * Defined in [src/definition/api/IApiExample.ts:7](https://github.com/RocketChat/Rocket.Chat.Apps-engine/blob/master/src/definition/api/IApiExample.ts#L7) #### `Optional` content content?: any * Defined in [src/definition/api/IApiExample.ts:8](https://github.com/RocketChat/Rocket.Chat.Apps-engine/blob/master/src/definition/api/IApiExample.ts#L8) ``` -------------------------------- ### UI Kit Blocks Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IPersistence.IPersistence.html Documentation for UI Kit blocks and their builders, elements, and objects. ```APIDOC ## UI Kit Blocks This section details the components for building UI elements within the UI Kit. ### Components - **blocks**: Namespace for UI Kit block components. - **BlockBuilder**: Builder class for creating UI blocks. - **Blocks**: Utility class for block-related operations. - **Elements**: Contains definitions for UI elements within blocks. - **Objects**: Represents various objects used in UI Kit blocks. ``` -------------------------------- ### AppsEngineException - stackTraceLimit Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/classes/exceptions_InvalidSettingValueException.InvalidSettingValueException.html Gets or sets the maximum number of stack frames to capture. Inherited from AppsEngineException. ```APIDOC ## stackTraceLimit ### Description Gets or sets the maximum number of stack frames to capture. ### Type number ### Inherited from [AppsEngineException](exceptions_AppsEngineException.AppsEngineException.html).[stackTraceLimit](exceptions_AppsEngineException.AppsEngineException.html#stackTraceLimit) ### Defined in node_modules/@types/node/globals.d.ts:13 ``` -------------------------------- ### IPostLivechatRoomStarted Interface Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/livechat_IPostLivechatRoomStarted.IPostLivechatRoomStarted.html The IPostLivechatRoomStarted interface defines the structure for handlers that are executed after a livechat room is started. ```APIDOC ## Interface IPostLivechatRoomStarted ### Description Handler called after a livechat room is started. ### Hierarchy * IPostLivechatRoomStarted ### Methods #### executePostLivechatRoomStarted * executePostLivechatRoomStarted(room: ILivechatRoom, read: IRead, http: IHttp, persis: IPersistence, modify?: IModify): Promise ### Parameters #### room * Type: ILivechatRoom * Description: The livechat room that was started. #### read * Type: IRead * Description: An accessor to the environment. #### http * Type: IHttp * Description: An accessor to the outside world. #### persis * Type: IPersistence * Description: An accessor to the App's persistence. #### modify (Optional) * Type: IModify * Description: An accessor to the modifier. ### Returns * Type: Promise * Description: This method does not return a value. ``` -------------------------------- ### UI Kit Blocks Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IOAuthAppsModify.IOAuthAppsModify.html Documentation for building UI elements using blocks in the Apps-Engine. ```APIDOC ## UI Kit Blocks ### Description Provides interfaces and builders for creating UI elements using a block-based system. ### Modules - `uikit/blocks`: General block-related types. - `uikit/blocks/BlockBuilder`: Builder for creating blocks. - `uikit/blocks/Blocks`: Core block types. - `uikit/blocks/Elements`: UI elements within blocks. - `uikit/blocks/Objects`: Objects used in blocks. ``` -------------------------------- ### getUsernames Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IDiscussionBuilder.IDiscussionBuilder.html Gets the usernames of users in the room. This method is deprecated in favor of `getMembersUsernames` and will be removed in version 2.0.0. ```APIDOC ## GET /api/v1/rooms/{roomId}/users/usernames ### Description Gets the usernames of users in the specified room. ### Method GET ### Endpoint `/api/v1/rooms/{roomId}/users/usernames` ### Parameters #### Path Parameters - **roomId** (string) - Required - The ID of the room. ### Response #### Success Response (200) - **usernames** (string[]) - A list of usernames in the room. #### Response Example ```json { "usernames": [ "user1", "user2" ], "success": true } ``` ``` -------------------------------- ### Settings Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/uikit_UIKitIncomingInteractionTypes.IUIKitActionButtonMessageBoxIncomingInteraction.html Information regarding settings for UI Kit components. ```APIDOC ## Settings ### Member Visibility * Protected * Inherited * External ### Theme OSLightDark ``` -------------------------------- ### UI Kit Blocks Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/classes/exceptions_FileUploadNotAllowedException.FileUploadNotAllowedException.html Documentation for UI Kit blocks and their builders. ```APIDOC ## UI Kit Blocks This section details the blocks and elements available within the UI Kit. ### Blocks and Elements - **blocks**: Namespace for UI Kit blocks. - **blocks/BlockBuilder**: Builder class for creating UI Kit blocks. - **blocks/Blocks**: Utility class for working with UI Kit blocks. - **blocks/Elements**: Namespace for UI Kit elements. - **blocks/Objects**: Namespace for UI Kit objects. ``` -------------------------------- ### App Information API Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/IApp.IApp.html This section covers methods for retrieving essential information about an installed Rocket.Chat application. ```APIDOC ## GET /api/v1/apps/version ### Description Retrieves the API version that the App depends on. This is used for dependency injections. ### Method GET ### Endpoint /api/v1/apps/version ### Parameters None ### Request Example None ### Response #### Success Response (200) - **apiVersions** (string[]) - An array of strings representing the required API versions. #### Response Example { "apiVersions": ["1.0.0"] } ``` ```APIDOC ## GET /api/v1/apps/status ### Description Gets the current status or state of the App. ### Method GET ### Endpoint /api/v1/apps/status ### Parameters None ### Request Example None ### Response #### Success Response (200) - **status** (AppStatus) - The current status of the App. #### Response Example { "status": "installed" } ``` ```APIDOC ## GET /api/v1/apps/version ### Description Gets the version of this App, following the semantic versioning specification (semver.org). ### Method GET ### Endpoint /api/v1/apps/version ### Parameters None ### Request Example None ### Response #### Success Response (200) - **version** (string) - The version of the App. #### Response Example { "version": "1.2.3" } ``` -------------------------------- ### Provide App Settings Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt Use `provideSetting` to define various types of settings for your app, such as string, boolean, select, and room pickers. Ensure `id`, `type`, and `i18nLabel` are provided. Some settings may require `packageValue`, `required`, or `public` to be set. ```typescript await configuration.settings.provideSetting({ id: 'api-key', type: SettingType.STRING, packageValue: '', required: true, public: false, i18nLabel: 'API Key', i18nDescription: 'Your API key for the external service', }); ``` ```typescript await configuration.settings.provideSetting({ id: 'enable-notifications', type: SettingType.BOOLEAN, packageValue: true, required: false, public: true, i18nLabel: 'Enable Notifications', }); ``` ```typescript await configuration.settings.provideSetting({ id: 'log-level', type: SettingType.SELECT, packageValue: 'info', values: [ { key: 'debug', i18nLabel: 'Debug' }, { key: 'info', i18nLabel: 'Info' }, { key: 'warn', i18nLabel: 'Warning' }, { key: 'error', i18nLabel: 'Error' }, ], required: true, public: true, i18nLabel: 'Log Level', }); ``` ```typescript await configuration.settings.provideSetting({ id: 'notification-room', type: SettingType.ROOM_PICK, packageValue: '', required: false, public: true, i18nLabel: 'Notification Room', i18nDescription: 'Room where notifications will be sent', }); ``` -------------------------------- ### Auto-Reply to Mentions Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt Implement `executePostMessageSent` to perform actions after a message is sent. This example provides an auto-reply when the bot is mentioned. ```typescript public async executePostMessageSent( message: IMessage, read: IRead, http: IHttp, persistence: IPersistence, modify: IModify ): Promise { // Auto-reply when mentioned const appUser = await read.getUserReader().getAppUser(); if (!appUser) return; const reply = modify.getCreator().startMessage() .setSender(appUser) .setRoom(message.room) .setText(`Hi ${message.sender.username}, how can I help you?`); if (message.threadId) { reply.setThreadId(message.threadId); } else if (message.id) { reply.setThreadId(message.id); } await modify.getCreator().finish(reply); } ``` -------------------------------- ### Modify Message Content Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt Use `executePreMessageSentModify` to alter message content before it's sent. This example replaces 'badword' with '****'. ```typescript public async executePreMessageSentModify( message: IMessage, builder: IMessageBuilder, read: IRead, http: IHttp, persistence: IPersistence ): Promise { // Censor certain words let text = message.text || ''; text = text.replace(/badword/gi, '****'); builder.setText(text); return builder.getMessage(); } ``` -------------------------------- ### Settings and Slash Commands Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/uikit_blocks_Blocks.ISectionBlock.html Interfaces for managing application settings and slash commands. ```APIDOC ## Settings and Slash Commands ### Description Interfaces for configuring application settings and defining slash commands. ### Settings Interfaces - `ISetting`: Represents an application setting. - `ISettingUpdateContext`: Context for updating settings. ### Settings Enums - `SettingType`: Defines types of settings. ### Slash Command Interfaces - `ISlashCommand`: Represents a slash command. - `ISlashCommandPreview`: Represents a preview of a slash command. - `SlashCommandContext`: Context for slash command execution. ``` -------------------------------- ### Settings Module Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/modules/scheduler_IOnetimeSchedule.html Module for managing app settings. ```APIDOC ## Settings Module ### Description Provides functionalities for managing application settings. ### Endpoint `/settings` ### Parameters This section is not explicitly defined in the provided text. ``` -------------------------------- ### Livechat Agent Room Count Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_ILivechatRead.ILivechatRead.html API for getting the total number of open livechat rooms for a specific agent. ```APIDOC ## GET /api/livechat/agent/:agentId/open-rooms ### Description Retrieves the total count of open livechat rooms assigned to a specific agent. ### Method GET ### Endpoint /api/livechat/agent/:agentId/open-rooms ### Parameters #### Path Parameters - **agentId** (string) - Required - The ID of the agent. ### Response #### Success Response (200) - **count** (number) - The total number of open rooms for the agent. #### Response Example ```json { "count": 5 } ``` ``` -------------------------------- ### IApiEndpointMetadata Interface Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/api_IApiEndpointMetadata.IApiEndpointMetadata.html Defines the structure for API endpoint metadata, including path, computed path, HTTP methods, and optional examples. ```APIDOC ## Interface IApiEndpointMetadata ### Description Represents the metadata for an API endpoint, specifying its path, HTTP methods, and optional examples. ### Properties * **path** (string) - Required - The base path for the API endpoint. * **computedPath** (string) - Required - The computed path for the API endpoint. * **methods** (string[]) - Required - An array of HTTP methods supported by the endpoint (e.g., `["get", "post"]`). * **examples** (object) - Optional - An object containing example requests and responses for the endpoint. The keys are arbitrary, and the values are of type `IApiExample`. ### Type Declaration for examples `IApiEndpointMetadata.examples` is an object where each key is a string and the value is an `IApiExample` object. ```typescript { [key: string]: IApiExample; } ``` ### Defined In `src/definition/api/IApiEndpointMetadata.ts:3` ``` -------------------------------- ### Settings Module Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/functions/livechat_ILivechatRoom.isLivechatRoom.html Interfaces for managing application settings. ```APIDOC ## Settings Module This module defines interfaces for application settings. ### Interfaces - **ISetting**: Represents a setting. - **ISettingUpdateContext**: Context for setting updates. ### Types - **SettingType**: Defines the type of a setting. ``` -------------------------------- ### IMessageBuilder - setParseUrls Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IMessageBuilder.IMessageBuilder.html Sets whether this message should have any URLs in the text parsed by Rocket.Chat and get the details added to the message's attachments. ```APIDOC ## setParseUrls ### Description Sets whether this message should have any URLs in the text parsed by Rocket.Chat and get the details added to the message's attachments. ### Method Not applicable (this is a method of a class/interface) ### Endpoint Not applicable ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "parseUrls": "boolean" } ``` ### Response #### Success Response (200) Returns the IMessageBuilder instance for chaining. #### Response Example ```json { "messageBuilderInstance": "IMessageBuilder" } ``` ``` -------------------------------- ### Setting Interface Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/modules/scheduler_IOnetimeSchedule.html Interface for a single app setting. ```APIDOC ## Setting Interface ### Description Defines the structure for an individual application setting. ### Endpoint `/settings/ISetting` ### Parameters This section is not explicitly defined in the provided text. ``` -------------------------------- ### Compile Apps-Engine Changes Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/README.md Run these commands in the Apps-Engine directory to install dependencies and compile your changes. This is necessary before integrating with the Rocket.Chat server. ```sh npm install npm run compile ``` -------------------------------- ### UI Kit Live Chat Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/livechat_IPostLivechatRoomClosed.IPostLivechatRoomClosed.html Documentation for UI Kit integrations with Live Chat, handling incoming interactions and actions. ```APIDOC ## UI Kit Live Chat ### Description Provides interfaces for integrating UI Kit functionalities with Rocket.Chat's Live Chat feature, enabling custom interaction handling. ### Modules - `uikit/livechat`: Main module for UI Kit Live Chat integration. - `uikit/livechat/IUIKitLivechatActionHandler`: Handler for Live Chat actions. - `uikit/livechat/IUIKitLivechatIncomingInteraction`: Interface for incoming Live Chat interactions. - `uikit/livechat/UIKitLivechatIncomingInteractionType`: Defines types for Live Chat interactions. - `uikit/livechat/UIKitLivechatInteractionContext`: Context for Live Chat interactions. ``` -------------------------------- ### UI Kit Live Chat Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/classes/api_ApiEndpoint.ApiEndpoint.html Documentation for UI Kit integrations with Live Chat functionalities. ```APIDOC ## UI Kit Live Chat ### Description This section covers the interfaces and types related to integrating UI Kit with Rocket.Chat's Live Chat features, enabling richer agent and visitor interactions. ### Modules - `uikit/livechat`: Core Live Chat UI Kit functionalities. - `uikit/livechat/IUIKitLivechatActionHandler`: Handles actions within Live Chat UI. - `uikit/livechat/IUIKitLivechatIncomingInteraction`: Defines incoming interactions for Live Chat. - `uikit/livechat/UIKitLivechatIncomingInteractionType`: Specifies types of incoming Live Chat interactions. - `uikit/livechat/UIKitLivechatInteractionContext`: Provides context for Live Chat interactions. ``` -------------------------------- ### Check Post-Message Sent Handler Condition Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt Use `checkPostMessageSent` to determine if a post-message handler should execute. This example triggers only for messages mentioning '@bot'. ```typescript public async checkPostMessageSent( message: IMessage, read: IRead, http: IHttp ): Promise { // Only process messages mentioning @bot return message.text?.includes('@bot') || false; } ``` -------------------------------- ### UI Kit Interfaces Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IModifyUpdater.IModifyUpdater.html Interfaces for building and handling UI Kit components. ```APIDOC ## UI Kit Interfaces ### Description Interfaces for handling incoming UI Kit interactions and defining UI Kit action handlers. ### Interfaces - `IUIKitActionHandler` - `IUIKitIncomingInteraction` - `IUIKitIncomingInteractionActionButton` ``` -------------------------------- ### IVideoConferenceExtender - setStatus Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IVideoConferenceExtend.IVideoConferenceExtender.html Sets the status of the video conference. This method is used to update the current state of the video conference, such as 'started', 'ended', or 'error'. ```APIDOC ## setStatus ### Description Sets the status of the video conference. ### Method Not applicable (this is a method signature within a class/interface). ### Endpoint Not applicable. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **value** (VideoConferenceStatus) - Required - The new status for the video conference (e.g., 'started', 'ended'). ### Request Example ```json { "value": "started" } ``` ### Response #### Success Response (200) - **IVideoConferenceExtender** - Returns the IVideoConferenceExtender interface for chaining methods. #### Response Example ```json { "message": "Video conference status updated successfully" } ``` ``` -------------------------------- ### UI Kit Interfaces Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/enums/uikit_UIKitIncomingInteractionContainer.UIKitIncomingInteractionContainerType.html Interfaces for building and handling UI Kit elements. ```APIDOC ## UI Kit Interfaces ### Description Provides interfaces for building and handling interactive UI elements using the UI Kit. ### Interfaces - `IUIKitActionHandler`: Handler for UI Kit actions. - `IUIKitIncomingInteraction`: Represents an incoming interaction from the UI Kit. - `IUIKitIncomingInteractionActionButton`: Represents a button interaction within the UI Kit. - `IUIKitInteractionType`: Defines the type of UI Kit interaction. - `IUIKitSurface`: Represents a surface in the UI Kit (e.g., modal, view). - `IUIKitView`: Represents a view within a UI Kit surface. ``` -------------------------------- ### Check Pre-Message Sent Handler Condition Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt Use `checkPreMessageSentPrevent` to determine if a message event handler should run. This example only processes messages with text content. ```typescript public async checkPreMessageSentPrevent( message: IMessage, read: IRead, http: IHttp ): Promise { // Only check messages with text content return !!message.text; } ``` -------------------------------- ### UI Kit Interfaces Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IHttp.IHttpPreResponseHandler.html Interfaces for building UI Kit components. ```APIDOC ## UI Kit Interfaces ### Description Provides interfaces for working with UI Kit components. ### Interfaces - `uikit` ``` -------------------------------- ### Extend Message with Attachments Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt Implement `executePreMessageSentExtend` to add information to a message without altering its original content. This example adds an attachment if the message contains a URL. ```typescript public async executePreMessageSentExtend( message: IMessage, extend: IMessageExtender, read: IRead, http: IHttp, persistence: IPersistence ): Promise { // Add an attachment if message contains a URL if (message.text?.includes('http')) { extend.addAttachment({ title: { value: 'Link detected' }, text: 'This message contains a URL', color: '#0000FF' }); } return extend.getMessage(); } ``` -------------------------------- ### UI Kit Blocks Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_INotifier.INotifier.html Provides utilities for creating UI Kit blocks. ```APIDOC ## uikit/blocks ### Description Module for creating UI Kit blocks. ### Module `blocks` ``` -------------------------------- ### Prevent Messages with Banned Words Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt Implement `executePreMessageSentPrevent` to block messages containing specific words. This example censors messages with 'spam' or 'inappropriate' and notifies the user. ```typescript public async executePreMessageSentPrevent( message: IMessage, read: IRead, http: IHttp, persistence: IPersistence ): Promise { const bannedWords = ['spam', 'inappropriate']; const text = message.text?.toLowerCase() || ''; const shouldPrevent = bannedWords.some(word => text.includes(word)); if (shouldPrevent) { // Notify the user their message was blocked const notifier = read.getNotifier(); const msgBuilder = notifier.getMessageBuilder() .setSender(message.sender) .setRoom(message.room) .setText('Your message was blocked due to inappropriate content.'); await notifier.notifyUser(message.sender, msgBuilder.getMessage()); } return shouldPrevent; // true = prevent message, false = allow } ``` -------------------------------- ### Make Request with Query String using IHttp Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt Illustrates how to append a query string to a GET request URL using the 'query' option in the IHttp accessor. ```typescript // Request with query string const searchResponse = await http.get('https://api.example.com/search', { query: 'name=test&status=active' // Appended as ?name=test&status=active }); ``` -------------------------------- ### UI Kit Interfaces Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/uploads_IFileUploadContext.IFileUploadContext.html Interfaces for building and interacting with UI Kit components. ```APIDOC ## UI Kit Interfaces Interfaces for the UI Kit. ### IUIKitActionHandler Handler for UI Kit actions. ### IUIKitIncomingInteraction Represents an incoming interaction from the UI Kit. ### IUIKitIncomingInteractionActionButton Represents a button interaction within the UI Kit. ### IUIKitInteractionType Defines the type of UI Kit interaction. ### IUIKitSurface Represents a surface in the UI Kit (e.g., modal, view). ### IUIKitView Represents a view within the UI Kit. ``` -------------------------------- ### UI Module Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/accessors_IMessageBuilder.IMessageBuilder.html Contains interfaces for UI elements and actions. ```APIDOC ## UI Module ### Description Contains interfaces for UI elements and actions. ### Endpoint N/A (Module documentation) ### Interfaces - **IUIActionButtonDescriptor**: Describes a UI action button. - **UIActionButtonContext**: Represents the context for a UI action button. ``` -------------------------------- ### Get App Bot User and Unread Message Count Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt Access the application's dedicated bot user and retrieve the unread message count for a specific user. ```typescript const appUser = await userReader.getAppUser(); // App's bot user const unreadCount = await userReader.getUserUnreadMessageCount(userId); ``` -------------------------------- ### UI Kit APIs Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/modules/accessors_IUploadRead.html APIs for building and interacting with UI Kit elements. ```APIDOC ## UI Kit APIs ### Description APIs for creating and managing UI Kit surfaces and interactions. ### Method GET ### Endpoint /api/v1/apps/uikit ### Parameters None ### Response #### Success Response (200) - **data** (object) - UI Kit service interface. #### Response Example ```json { "data": { "createView": "function", "handleInteraction": "function" } } ``` ``` ```APIDOC ## UI Kit View API ### Description Defines the structure for a UI Kit view. ### Method GET ### Endpoint /api/v1/apps/uikit/IUIKitView ### Parameters None ### Response #### Success Response (200) - **data** (object) - IUIKitView definition. #### Response Example ```json { "data": { "id": "string", "blocks": "array" } } ``` ``` ```APIDOC ## UI Kit Interaction APIs ### Description APIs for handling incoming UI Kit interactions. ### Method POST ### Endpoint /api/v1/apps/uikit/interactions ### Parameters #### Request Body - **interaction** (object) - Required - The incoming interaction object. ### Request Example ```json { "interaction": { "type": "buttonClicked", "view": { "id": "myView" }, "user": { "id": "userId" } } } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the interaction was processed successfully. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Settings Interfaces Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/modules/assets_IAsset.html Interfaces for managing application and system settings. ```APIDOC ## Settings Interfaces ### Description Interfaces for defining, retrieving, and updating settings, including setting types and update contexts. ### Endpoints - `settings` - `settings/ISetting` - `settings/ISettingUpdateContext` - `settings/SettingType` ``` -------------------------------- ### Webhook Endpoint (Public) Source: https://context7.com/rocketchat/rocket.chat.apps-engine/llms.txt This endpoint is designed for receiving webhook requests from external systems. It supports GET for health checks and POST for processing messages. It does not require authentication. ```APIDOC ## GET /api/apps/public/{app-id}/webhook ### Description Checks the health status of the webhook endpoint. ### Method GET ### Endpoint /api/apps/public/{app-id}/webhook ### Parameters None ### Request Example None ### Response #### Success Response (200) - **status** (string) - Indicates the health status, e.g., "healthy". - **timestamp** (string) - The ISO 8601 formatted timestamp of the request. #### Response Example { "status": "healthy", "timestamp": "2023-10-27T10:00:00.000Z" } ``` ```APIDOC ## POST /api/apps/public/{app-id}/webhook ### Description Processes incoming messages via webhook. It expects a JSON payload with `roomId` and `message` and sends the message to the specified room. ### Method POST ### Endpoint /api/apps/public/{app-id}/webhook ### Parameters None ### Request Body - **roomId** (string) - Required - The ID of the room to send the message to. - **message** (string) - Required - The content of the message to send. ### Request Example { "roomId": "GENERAL", "message": "Hello from webhook!" } ### Response #### Success Response (200) - **success** (boolean) - Indicates if the message was sent successfully. - **messageId** (string) - A placeholder indicating the message was processed. #### Error Response (400) - **error** (string) - Description of the error, e.g., "roomId and message are required". #### Error Response (404) - **error** (string) - "Room not found". #### Error Response (500) - **error** (string) - "App user not found". #### Response Example { "success": true, "messageId": "sent" } ``` -------------------------------- ### Settings and Slash Commands Interfaces Source: https://github.com/rocketchat/rocket.chat.apps-engine/blob/alpha/docs/interfaces/rooms_IPreRoomCreatePrevent.IPreRoomCreatePrevent.html Interfaces for managing application settings and slash commands. ```APIDOC ## Settings and Slash Commands Interfaces ### Description Interfaces for managing application settings and defining slash commands. ### Settings Interfaces - `ISetting` - `ISettingUpdateContext` - `SettingType` ### Slash Commands Interfaces - `ISlashCommand` - `ISlashCommandPreview` - `SlashCommandContext` ```