in-app-message-list
Retrieve a paginated list of in-app messages with search functionality to locate messages by name, description, or campaign key, enabling efficient management of A/B test messages.
Instructions
Fetches a paginated list of in-app messages with search functionality.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pageNumber | No | ||
| pageSize | No | ||
| searchKeyword | No | name, description, or campaignKey of an in-app message. |
Implementation Reference
- src/index.ts:72-91 (handler)The handler function for the 'in-app-message-list' tool. It constructs query parameters for pagination and search, fetches the list from the Hackle API using WebClient.get, stringifies the JSON response, and returns it as text content.async ({ pageNumber = 1, pageSize = 100, searchKeyword = '' }) => { const qs = stringify( { pageNumber, pageSize, searchKeyword, }, { addQueryPrefix: true }, ); return { content: [ { type: 'text', text: JSON.stringify(await WebClient.get(`/api/v1/in-app-messages${qs}`)), }, ], }; }, );
- src/index.ts:67-71 (schema)Zod input schema defining optional pagination (pageNumber, pageSize) and searchKeyword parameters for the tool.{ pageNumber: z.number().optional().default(1), pageSize: z.number().optional().default(100), searchKeyword: z.string().optional().describe('name, description, or campaignKey of an in-app message.'), },
- src/index.ts:64-91 (registration)The complete server.tool registration for the 'in-app-message-list' tool, including name, description, input schema, and inline handler function.server.tool( 'in-app-message-list', 'Fetches a paginated list of in-app messages with search functionality.', { pageNumber: z.number().optional().default(1), pageSize: z.number().optional().default(100), searchKeyword: z.string().optional().describe('name, description, or campaignKey of an in-app message.'), }, async ({ pageNumber = 1, pageSize = 100, searchKeyword = '' }) => { const qs = stringify( { pageNumber, pageSize, searchKeyword, }, { addQueryPrefix: true }, ); return { content: [ { type: 'text', text: JSON.stringify(await WebClient.get(`/api/v1/in-app-messages${qs}`)), }, ], }; }, );
- src/WebClient.ts:70-72 (helper)The WebClient.get method used by the tool handler to perform the HTTP GET request to the Hackle API.public static async get<T = unknown>(path: string, options?: Omit<RequestInit, 'method'>): Promise<T> { return this.request<T>('GET', path, options); }