Skip to main content
Glama
by wsapi-chat

whatsapp_update_api_key

Generate a new API key for your WhatsApp instance to maintain secure access and session management when using the WSAPI service.

Instructions

Generate a new API key for the instance.

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • The handler function that implements the whatsapp_update_api_key tool. It generates a new API key by making a PUT request to the WSAPI endpoint '/instance/apikey' and returns the result.
    export const updateApiKey: ToolHandler = { name: 'whatsapp_update_api_key', description: 'Generate a new API key for the instance.', inputSchema: { type: 'object', properties: {} }, handler: async () => { logger.info('Updating API key'); const result = await wsapiClient.put('/instance/apikey', {}); return { success: true, apiKey: result, message: 'API key updated successfully' }; }, };
  • Input schema definition for the tool (no input parameters required).
    inputSchema: { type: 'object', properties: {} },
  • The updateApiKey tool is bundled into the instanceTools object for registration in the MCP server.
    export const instanceTools = { getInstanceSettings, updateInstanceSettings, restartInstance, updateApiKey };
  • src/server.ts:53-79 (registration)
    The MCP server registers all tools from instanceTools (including whatsapp_update_api_key) into a Map for handling tool calls.
    private setupToolHandlers(): void { logger.info('Setting up tool handlers'); // Register all tool categories const toolCategories = [ messagingTools, contactTools, groupTools, chatTools, sessionTools, instanceTools, accountTools, ]; toolCategories.forEach(category => { Object.values(category).forEach(tool => { if (this.tools.has(tool.name)) { logger.warn(`Tool ${tool.name} already registered, skipping`); return; } this.tools.set(tool.name, tool); logger.debug(`Registered tool: ${tool.name}`); }); }); logger.info(`Registered ${this.tools.size} tools`); }
  • src/server.ts:20-20 (registration)
    Imports the instanceTools object containing the whatsapp_update_api_key tool.
    import { instanceTools } from './tools/instance.js';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wsapi-chat/wsapi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server