whatsapp_send_sticker
Send sticker messages to WhatsApp contacts or groups using URL or base64 data. This tool enables automated sticker sharing through the WSAPI WhatsApp MCP Server.
Instructions
Send a sticker message to a WhatsApp contact or group. Can send from URL or base64.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Recipient phone number (with @s.whatsapp.net) or group ID (with @g.us) | |
| stickerBase64 | No | Base64 encoded sticker data (alternative to stickerURL) | |
| stickerURL | No | URL of the sticker to send (alternative to stickerBase64) | |
| mimeType | Yes | MIME type of the sticker (must be image/webp) | |
| isAnimated | No | Whether the sticker is animated | |
| mentions | No | List of phone numbers to mention | |
| replyTo | No | ID of the message being replied to | |
| isForwarded | No | Whether the message should be marked as forwarded |
Implementation Reference
- src/tools/messaging-advanced.ts:229-297 (handler)Primary handler implementation for the 'whatsapp_send_sticker' tool. Defines the tool metadata, JSON input schema for MCP, and the execution logic which validates input using Zod schema and posts to WSAPI /messages/sticker endpoint.export const sendStickerMessage: ToolHandler = { name: 'whatsapp_send_sticker', description: 'Send a sticker message to a WhatsApp contact or group. Can send from URL or base64.', inputSchema: { type: 'object', properties: { to: { type: 'string', description: 'Recipient phone number (with @s.whatsapp.net) or group ID (with @g.us)', }, stickerBase64: { type: 'string', description: 'Base64 encoded sticker data (alternative to stickerURL)', optional: true, }, stickerURL: { type: 'string', description: 'URL of the sticker to send (alternative to stickerBase64)', optional: true, }, mimeType: { type: 'string', enum: ['image/webp'], description: 'MIME type of the sticker (must be image/webp)', }, isAnimated: { type: 'boolean', description: 'Whether the sticker is animated', optional: true, }, mentions: { type: 'array', items: { type: 'string' }, description: 'List of phone numbers to mention', optional: true, }, replyTo: { type: 'string', description: 'ID of the message being replied to', optional: true, }, isForwarded: { type: 'boolean', description: 'Whether the message should be marked as forwarded', optional: true, }, }, required: ['to', 'mimeType'], }, handler: async (args: any) => { const input = validateInput(sendStickerMessageSchema, args) as SendStickerMessageInput; logger.info('Sending sticker message', { to: input.to, mimeType: input.mimeType, isAnimated: input.isAnimated, }); const result = await wsapiClient.post('/messages/sticker', input); logger.info('Sticker message sent successfully', { messageId: result.id }); return { success: true, messageId: result.id, message: 'Sticker message sent successfully', }; }, };
- src/validation/schemas.ts:86-97 (schema)Zod validation schema (sendStickerMessageSchema) for the tool input, defining types and constraints, used in the handler's validateInput call.export const sendStickerMessageSchema = z.object({ to: chatIdSchema, stickerBase64: base64Schema.optional(), stickerURL: urlSchema.optional(), mimeType: z.enum(['image/webp']), isAnimated: z.boolean().optional(), mentions: z.array(phoneNumberSchema).optional(), replyTo: messageIdSchema.optional(), isForwarded: z.boolean().optional(), }).refine(data => data.stickerBase64 || data.stickerURL, { message: "Either stickerBase64 or stickerURL must be provided", });
- src/tools/messaging-advanced.ts:425-432 (registration)Export of advancedMessagingTools object that includes the sendStickerMessage handler, which is later imported and spread into the main messagingTools for server registration.export const advancedMessagingTools = { sendAudioMessage, sendVoiceMessage, sendDocumentMessage, sendStickerMessage, sendLocationMessage, sendContactMessage, };
- src/server.ts:53-76 (registration)Server method that dynamically registers all tools from imported categories (including messagingTools which contains whatsapp_send_sticker) into the MCP server's tool map.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}`); }); });