whatsapp_get_contact_business
Retrieve business profile details for a WhatsApp contact using their phone number, enabling access to company information, description, and business attributes.
Instructions
Get the business profile information of a WhatsApp contact.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contactId | Yes | Contact ID (phone number with @s.whatsapp.net) |
Input Schema (JSON Schema)
{
"properties": {
"contactId": {
"description": "Contact ID (phone number with @s.whatsapp.net)",
"type": "string"
}
},
"required": [
"contactId"
],
"type": "object"
}
Implementation Reference
- src/tools/contacts.ts:186-214 (handler)The main ToolHandler implementation for 'whatsapp_get_contact_business'. Defines the tool name, description, inputSchema, and handler function that validates input using getContactSchema and fetches business profile via wsapiClient.export const getContactBusinessProfile: ToolHandler = { name: 'whatsapp_get_contact_business', description: 'Get the business profile information of a WhatsApp contact.', inputSchema: { type: 'object', properties: { contactId: { type: 'string', description: 'Contact ID (phone number with @s.whatsapp.net)', }, }, required: ['contactId'], }, handler: async (args: any) => { const input = validateInput(getContactSchema, args); logger.info('Getting contact business profile', { contactId: input.contactId }); const result = await wsapiClient.get(`/contacts/${input.contactId}/business`); logger.info('Retrieved contact business profile successfully', { contactId: input.contactId }); return { success: true, businessProfile: result, message: 'Contact business profile retrieved successfully', }; }, };
- src/validation/schemas.ts:173-175 (schema)Zod schema used for input validation in the whatsapp_get_contact_business handler. Defines contactId as a phone number matching the WhatsApp format.export const getContactSchema = z.object({ contactId: phoneNumberSchema, });
- src/server.ts:53-79 (registration)Registers the tool by including contactTools (which exports getContactBusinessProfile) in toolCategories and adding all tools to the server's tools Map for MCP handling.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`); }