send_buttons
Send interactive WhatsApp messages with customizable buttons to recipients, enabling quick responses for business communications and customer engagement.
Instructions
Send message with buttons
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| buttons | Yes | Array of buttons | |
| description | No | Message description | |
| footer | No | Message footer | |
| instanceName | Yes | Instance name | |
| number | Yes | Recipient phone number | |
| title | No | Message title |
Implementation Reference
- src/index.ts:133-158 (registration)Registration of the 'send_buttons' tool in the tools array, including name, description, and input schema definition.{ name: 'send_buttons', description: 'Send message with buttons', inputSchema: { type: 'object', properties: { instanceName: { type: 'string', description: 'Instance name' }, number: { type: 'string', description: 'Recipient phone number' }, title: { type: 'string', description: 'Message title' }, description: { type: 'string', description: 'Message description' }, footer: { type: 'string', description: 'Message footer' }, buttons: { type: 'array', items: { type: 'object', properties: { buttonId: { type: 'string' }, displayText: { type: 'string' } } }, description: 'Array of buttons' } }, required: ['instanceName', 'number', 'buttons'] } },
- src/index.ts:667-688 (handler)The primary handler function for the 'send_buttons' tool. It transforms the input buttons format, calls the EvolutionAPI sendButtons method, and formats the response as MCP content.private async handleSendButtons(args: any) { const buttons = args.buttons.map((btn: any) => ({ buttonId: btn.buttonId, buttonText: { displayText: btn.displayText } })); const result = await evolutionAPI.sendButtons(args.instanceName, { number: args.number, title: args.title, description: args.description, footer: args.footer, buttons }); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
- Helper method in EvolutionAPI service that performs the actual HTTP POST request to the Evolution API endpoint /message/sendButtons/{instanceName} to send buttons message.async sendButtons(instanceName: string, data: { number: string; title?: string; description?: string; footer?: string; buttons: Array<{ buttonId: string; buttonText: { displayText: string }; }>; }): Promise<Message> { const response = await this.client.post(`/message/sendButtons/${instanceName}`, data); return response.data; }