Skip to main content
Glama

waha_unpin_message

Remove a pinned message from a WhatsApp chat to clear the pinned message slot and manage chat organization.

Instructions

Unpin a message in a chat.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chatIdYesChat ID (format: number@c.us)
messageIdYesMessage ID to unpin

Implementation Reference

  • src/index.ts:239-256 (registration)
    Tool registration and schema definition in the ListToolsRequestSchema handler. Defines name, description, and input schema (chatId and messageId required).
    {
      name: "waha_unpin_message",
      description: "Unpin a message in a chat.",
      inputSchema: {
        type: "object",
        properties: {
          chatId: {
            type: "string",
            description: "Chat ID (format: number@c.us)",
          },
          messageId: {
            type: "string",
            description: "Message ID to unpin",
          },
        },
        required: ["chatId", "messageId"],
      },
    },
  • MCP tool handler function. Validates input parameters (chatId, messageId), calls the WAHA client unpinMessage method, and returns success message.
     * Handle waha_unpin_message tool
     */
    private async handleUnpinMessage(args: any) {
      const chatId = args.chatId;
      const messageId = args.messageId;
    
      if (!chatId) {
        throw new Error("chatId is required");
      }
    
      if (!messageId) {
        throw new Error("messageId is required");
      }
    
      await this.wahaClient.unpinMessage(chatId, messageId);
    
      return {
        content: [
          {
            type: "text",
            text: `Successfully unpinned message ${messageId} from chat ${chatId}.`,
          },
        ],
      };
    }
  • src/index.ts:1064-1067 (registration)
    Tool dispatch registration in the CallToolRequestSchema switch statement. Routes calls to waha_unpin_message to the handleUnpinMessage handler.
      return await this.handlePinMessage(args);
    case "waha_unpin_message":
      return await this.handleUnpinMessage(args);
    case "waha_clear_chat_messages":
  • Underlying WAHA client method that performs the actual HTTP POST request to unpin the message via the WAHA API endpoint.
    async unpinMessage(chatId: string, messageId: string): Promise<void> {
      if (!chatId) {
        throw new WAHAError("chatId is required");
      }
    
      if (!messageId) {
        throw new WAHAError("messageId is required");
      }
    
      const endpoint = `/api/${this.session}/chats/${encodeURIComponent(
        chatId
      )}/messages/${encodeURIComponent(messageId)}/unpin`;
    
      await this.request<void>(endpoint, {
        method: "POST",
      });
    }

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/seejux/waha-mcp'

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