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

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
NameRequiredDescriptionDefault
toYesRecipient phone number (with @s.whatsapp.net) or group ID (with @g.us)
stickerBase64NoBase64 encoded sticker data (alternative to stickerURL)
stickerURLNoURL of the sticker to send (alternative to stickerBase64)
mimeTypeYesMIME type of the sticker (must be image/webp)
isAnimatedNoWhether the sticker is animated
mentionsNoList of phone numbers to mention
replyToNoID of the message being replied to
isForwardedNoWhether the message should be marked as forwarded

Implementation Reference

  • 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', }; }, };
  • 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", });
  • 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}`); }); });

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