GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.
Go botgogolanggolang-whatsappgolang-whatsapp-apirestrest-apiwhatsappwhatsapp-apiwhatsapp-api-gowhatsapp-multi-devicewhatsapp-web-multi-device
feat: Add ghost mentions support (@everyone) (#570)
Aldino Kemalc7a182c9bb6b
diff --git a/src/ui/mcp/send.go b/src/ui/mcp/send.goindex f23c6b73..982b271a 100644--- a/src/ui/mcp/send.go+++ b/src/ui/mcp/send.go@@ -31,14 +31,14 @@ func (s *SendHandler) AddSendTools(mcpServer *server.MCPServer) {func (s *SendHandler) toolSendText() mcp.Tool {sendTextTool := mcp.NewTool("whatsapp_send_text",- mcp.WithDescription("Send a text message to a WhatsApp contact or group."),+ mcp.WithDescription("Send a text message to a WhatsApp contact or group. Supports ghost mentions (mention users without showing @phone in message text)."),mcp.WithString("phone",mcp.Required(),mcp.Description("Phone number or group ID to send message to"),),mcp.WithString("message",mcp.Required(),- mcp.Description("The text message to send"),+ mcp.Description("The text message to send."),),mcp.WithBoolean("is_forwarded",mcp.Description("Whether this message is being forwarded (default: false)"),@@ -46,6 +46,9 @@ func (s *SendHandler) toolSendText() mcp.Tool {mcp.WithString("reply_message_id",mcp.Description("Message ID to reply to (optional)"),),+ mcp.WithArray("mentions",+ mcp.Description("List of phone numbers or JIDs to mention (ghost mentions - users will be notified but @phone won't appear in message text). Use \"@everyone\" to mention all group participants. Example: [\"628123456789\", \"@everyone\"]"),+ ),)return sendTextTool@@ -72,6 +75,16 @@ func (s *SendHandler) handleSendText(ctx context.Context, request mcp.CallToolRereplyMessageId = ""}+ // Parse mentions array (ghost mentions)+ var mentions []string+ if mentionsRaw, ok := request.GetArguments()["mentions"].([]interface{}); ok {+ for _, m := range mentionsRaw {+ if mentionStr, ok := m.(string); ok {+ mentions = append(mentions, mentionStr)+ }+ }+ }+res, err := s.sendService.SendText(ctx, domainSend.MessageRequest{BaseRequest: domainSend.BaseRequest{Phone: phone,@@ -79,6 +92,7 @@ func (s *SendHandler) handleSendText(ctx context.Context, request mcp.CallToolRe},Message: message,ReplyMessageID: &replyMessageId,+ Mentions: mentions,})if err != nil {diff --git a/src/usecase/send.go b/src/usecase/send.goindex 66168d3d..9d55b4d4 100644--- a/src/usecase/send.go+++ b/src/usecase/send.go@@ -1316,7 +1316,7 @@ func (service serviceSend) getMentionsFromList(ctx context.Context, mentions []scontinue}- // Regular phone number mention+ // Validate phone number/JID with WhatsApp checkif dataWaRecipient, err := utils.ValidateJidWithLogin(client, mention); err == nil {result = append(result, dataWaRecipient.String())}