Skip to main content
Glama
luiso2

Evolution API WhatsApp MCP Server

by luiso2

create_template

Create customizable WhatsApp Business message templates with dynamic variables for order confirmations, appointment reminders, and promotional communications.

Instructions

Create a new message template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoTemplate category
descriptionNoTemplate description
nameYesTemplate name
tagsNoTemplate tags
textYesTemplate text with {{variables}}
variablesNoList of variable names

Implementation Reference

  • Primary handler function for the 'create_template' MCP tool. It constructs the template object from input arguments and delegates to TemplateService.createTemplate, then formats and returns the result.
    private async handleCreateTemplate(args: any) { const template = await templateService.createTemplate({ name: args.name, description: args.description, category: args.category, content: { text: args.text }, variables: args.variables, tags: args.tags }); return { content: [ { type: 'text', text: JSON.stringify(template, null, 2) } ] }; }
  • src/index.ts:223-245 (registration)
    Registration of the 'create_template' tool in the tools array, including name, description, and input schema definition.
    { name: 'create_template', description: 'Create a new message template', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Template name' }, description: { type: 'string', description: 'Template description' }, category: { type: 'string', description: 'Template category' }, text: { type: 'string', description: 'Template text with {{variables}}' }, variables: { type: 'array', items: { type: 'string' }, description: 'List of variable names' }, tags: { type: 'array', items: { type: 'string' }, description: 'Template tags' } }, required: ['name', 'text'] }
  • Core helper method in TemplateService that generates ID, creates the MessageTemplate object, stores it in memory map, persists to file, and returns the new template.
    async createTemplate(template: Omit<MessageTemplate, 'id' | 'createdAt' | 'updatedAt'>): Promise<MessageTemplate> { const id = this.generateTemplateId(template.name); const newTemplate: MessageTemplate = { ...template, id, createdAt: new Date(), updatedAt: new Date() }; this.templates.set(id, newTemplate); await this.saveCustomTemplates(); return newTemplate; }
  • Dispatch case in the main CallToolRequestSchema handler that routes 'create_template' calls to the specific handleCreateTemplate method.
    case 'create_template': return await this.handleCreateTemplate(args);
  • JSON schema defining input validation for the 'create_template' tool parameters.
    inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Template name' }, description: { type: 'string', description: 'Template description' }, category: { type: 'string', description: 'Template category' }, text: { type: 'string', description: 'Template text with {{variables}}' }, variables: { type: 'array', items: { type: 'string' }, description: 'List of variable names' }, tags: { type: 'array', items: { type: 'string' }, description: 'Template tags' } }, required: ['name', 'text']

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/luiso2/mcp-evolution-api'

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