Get Support Statuses
whmcs_get_support_statusesRetrieve a list of support ticket statuses along with the count of tickets in each status. Optionally filter by department ID to narrow results.
Instructions
Get ticket statuses with counts
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deptid | No | Filter by department ID |
Implementation Reference
- src/index.ts:586-601 (registration)Registration of the 'whmcs_get_support_statuses' tool via server.registerTool(), with input schema accepting an optional deptid filter
server.registerTool( 'whmcs_get_support_statuses', { title: 'Get Support Statuses', description: 'Get ticket statuses with counts', inputSchema: { deptid: z.number().optional().describe('Filter by department ID'), }, }, async (params) => { const result = await whmcsClient.getSupportStatuses(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } ); - src/whmcs-client.ts:807-816 (handler)Handler method getSupportStatuses() on WhmcsApiClient that calls the WHMCS API action 'GetSupportStatuses' and returns statuses with title, count, and color
async getSupportStatuses(params: { deptid?: number } = {}) { return this.call<WhmcsApiResponse & { totalresults: number; statuses: { status: Array<{ title: string; count: number; color: string; }> }; }>('GetSupportStatuses', params); } - src/whmcs-client.ts:29-63 (helper)The generic call() method on WhmcsApiClient that performs the actual HTTP POST request to the WHMCS API
async call<T extends WhmcsApiResponse>(action: string, params: Record<string, unknown> = {}): Promise<T> { const url = `${this.config.apiUrl.replace(/\/$/, '')}/includes/api.php`; const postData: Record<string, string> = { identifier: this.config.apiIdentifier, secret: this.config.apiSecret, action: action, responsetype: 'json', ...this.flattenParams(params) }; if (this.config.accessKey) { postData.accesskey = this.config.accessKey; } const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: new URLSearchParams(postData).toString(), }); if (!response.ok) { throw new Error(`WHMCS API request failed: ${response.status} ${response.statusText}`); } const data = await response.json() as T; if (data.result === 'error') { throw new Error(`WHMCS API error: ${data.message || 'Unknown error'}`); } return data; }