Skip to main content
Glama
wsapi-chat
by wsapi-chat

whatsapp_create_contact

Create a new WhatsApp contact by providing phone number, full name, and first name to add to your WhatsApp account.

Instructions

Create a new WhatsApp contact.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNameYesFirst name of the contact (max 255 characters)
fullNameYesFull name of the contact (max 255 characters)
idYesContact ID (phone number with @s.whatsapp.net)

Implementation Reference

  • Full ToolHandler implementation for 'whatsapp_create_contact', including inputSchema, validation using createContactSchema, logging, API call to wsapiClient.post('/contacts'), and success response.
    export const createContact: ToolHandler = { name: 'whatsapp_create_contact', description: 'Create a new WhatsApp contact.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Contact ID (phone number with @s.whatsapp.net)', }, fullName: { type: 'string', description: 'Full name of the contact (max 255 characters)', }, firstName: { type: 'string', description: 'First name of the contact (max 255 characters)', }, }, required: ['id', 'fullName', 'firstName'], }, handler: async (args: any) => { const input = validateInput(createContactSchema, args); logger.info('Creating contact', { id: input.id, fullName: input.fullName, }); await wsapiClient.post('/contacts', input); logger.info('Contact created successfully', { id: input.id }); return { success: true, message: 'Contact created successfully', }; }, };
  • Zod schema used for validating input in the whatsapp_create_contact handler.
    export const createContactSchema = z.object({ id: phoneNumberSchema, fullName: z.string().min(1).max(255), firstName: z.string().min(1).max(255), });
  • src/server.ts:57-79 (registration)
    Registration logic in setupToolHandlers() that imports and registers all tools from contactTools (including whatsapp_create_contact) into the server's tools Map.
    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`); }

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