fix: Populate meta field for whatsApp shared contacts (#12097)

Fixes https://github.com/chatwoot/chatwoot/issues/11999
This commit is contained in:
Muhsin Keloth
2025-08-05 01:50:45 +04:00
committed by GitHub
parent 65312744c7
commit 60a1e9b15d
2 changed files with 11 additions and 7 deletions

View File

@@ -156,11 +156,18 @@ class Whatsapp::IncomingMessageBaseService
phones = contact[:phones]
phones = [{ phone: 'Phone number is not available' }] if phones.blank?
name_info = contact['name'] || {}
contact_meta = {
firstName: name_info['first_name'],
lastName: name_info['last_name']
}.compact
phones.each do |phone|
@message.attachments.new(
account_id: @message.account_id,
file_type: file_content_type(message_type),
fallback_title: phone[:phone].to_s
fallback_title: phone[:phone].to_s,
meta: contact_meta
)
end
end