Send Button
send_buttonSend interactive WhatsApp button messages with up to three reply, URL, or call buttons via a pinned instance.
Instructions
Send a WhatsApp interactive button message via the pinned instance (max 3 buttons).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| number | Yes | Recipient JID or phone number (e.g. 5511999999999 or group@g.us) | |
| title | Yes | Message title | |
| description | Yes | Message body | |
| footer | No | Optional footer text | |
| buttons | Yes | Array of buttons (max 3) |
Implementation Reference
- src/tools/send-button.ts:23-48 (handler)The registerSendButton function registers the 'send_button' tool with the MCP server. The handler builds a payload with number, title, description, optional footer, and buttons array, then POSTs to /message/sendButtons/{instanceName} via the EvolutionClient.
export function registerSendButton(server: McpServer, client: EvolutionClient): void { server.registerTool( "send_button", { title: "Send Button", description: "Send a WhatsApp interactive button message via the pinned instance (max 3 buttons).", inputSchema: schema, }, async (args) => { try { const payload: Record<string, unknown> = { number: args.number, title: args.title, description: args.description, buttons: args.buttons, }; if (args.footer) payload["footer"] = args.footer; const data = await client.post(`/message/sendButtons/${client.instanceName}`, payload); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } catch (e) { if (e instanceof McpError) return { isError: true, content: [{ type: "text" as const, text: e.message }] }; throw e; } } ); } - src/tools/send-button.ts:7-21 (schema)ButtonSchema defines individual button objects with type (reply/url/call), displayText, and optional id/url/phoneNumber. The input schema includes number (PhoneOrJidSchema), title, description, optional footer, and an array of buttons.
const ButtonSchema = z.object({ type: z.enum(["reply", "url", "call"]).describe("Button type"), displayText: z.string().min(1).describe("Button label text"), id: z.string().optional().describe("Button ID for reply buttons"), url: z.string().url().optional().describe("URL for url-type buttons"), phoneNumber: z.string().optional().describe("Phone number for call-type buttons"), }); const schema = { number: PhoneOrJidSchema, title: z.string().min(1).describe("Message title"), description: z.string().min(1).describe("Message body"), footer: z.string().optional().describe("Optional footer text"), buttons: z.array(ButtonSchema).min(1).describe("Array of buttons (max 3)"), }; - src/tools/index.ts:96-96 (registration)The registerSendButton function is called in registerAllTools to register the 'send_button' tool with the server and client.
registerSendButton(server, client); - src/schemas.ts:8-11 (helper)PhoneOrJidSchema is used as the type for the 'number' field, accepting a JID or phone number string.
export const PhoneOrJidSchema = z .string() .min(1) .describe("Recipient JID or phone number (e.g. 5511999999999 or group@g.us)");