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 ContactsArrayMessage support in webhook payloads (#594)
lowprofix00ee65ba5d28
diff --git a/docs/webhook-payload.md b/docs/webhook-payload.mdindex 24b6b80c..9801afb3 100644--- a/docs/webhook-payload.md+++ b/docs/webhook-payload.md@@ -733,6 +733,8 @@ With auto-download disabled:### Contact Message+When a user shares a single contact:+```json{"event": "message",@@ -751,6 +753,36 @@ With auto-download disabled:}```+### Contacts Array Message++When a user shares multiple contacts at once (via WhatsApp's multi-contact share feature):++```json+{+ "event": "message",+ "device_id": "[email protected]",+ "payload": {+ "id": "A1B2C3D4E5F6789012345678",+ "chat_id": "[email protected]",+ "from": "[email protected]",+ "from_name": "John Doe",+ "timestamp": "2025-07-13T11:10:19Z",+ "contacts_array": [+ {+ "displayName": "Alice",+ "vcard": "BEGIN:VCARD\nVERSION:3.0\nN:;Alice;;;\nFN:Alice\nTEL;type=Mobile:+62 812 3456 7890\nEND:VCARD"+ },+ {+ "displayName": "Bob",+ "vcard": "BEGIN:VCARD\nVERSION:3.0\nN:;Bob;;;\nFN:Bob\nTEL;type=Mobile:+62 813 9876 5432\nEND:VCARD"+ }+ ]+ }+}+```++> **Note:** WhatsApp uses `ContactMessage` (field 4) for a single contact and `ContactsArrayMessage` (field 13) for multiple contacts. A single contact produces `"contact"`, while multiple contacts produce `"contacts_array"`.+### Location Message```jsondiff --git a/src/infrastructure/whatsapp/event_message.go b/src/infrastructure/whatsapp/event_message.goindex 8f7890ea..e1186da4 100644--- a/src/infrastructure/whatsapp/event_message.go+++ b/src/infrastructure/whatsapp/event_message.go@@ -341,6 +341,10 @@ func buildOtherMessageTypes(msg *waE2E.Message, payload map[string]any) {payload["contact"] = contactMessage}+ if contactsArrayMessage := msg.GetContactsArrayMessage(); contactsArrayMessage != nil {+ payload["contacts_array"] = contactsArrayMessage.GetContacts()+ }+if listMessage := msg.GetListMessage(); listMessage != nil {payload["list"] = listMessage}diff --git a/src/pkg/utils/whatsapp.go b/src/pkg/utils/whatsapp.goindex 5e1521ae..5752574a 100644--- a/src/pkg/utils/whatsapp.go+++ b/src/pkg/utils/whatsapp.go@@ -218,6 +218,14 @@ func ExtractMessageTextFromEvent(evt *events.Message) string {} else {messageText = "👤 " + messageText}+ } else if contactsArrayMessage := evt.Message.GetContactsArrayMessage(); contactsArrayMessage != nil {+ count := len(contactsArrayMessage.GetContacts())+ displayName := contactsArrayMessage.GetDisplayName()+ if displayName != "" {+ messageText = fmt.Sprintf("👥 %s (%d contacts)", displayName, count)+ } else {+ messageText = fmt.Sprintf("👥 %d contacts", count)+ }} else if listMessage := evt.Message.GetListMessage(); listMessage != nil {messageText = listMessage.GetTitle()if messageText == "" {