feat: Add the ability to receive contact(vCard) on a WhatsApp inbox (#6330)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
@@ -38,12 +38,13 @@ class Attachment < ApplicationRecord
|
||||
has_one_attached :file
|
||||
validate :acceptable_file
|
||||
|
||||
enum file_type: [:image, :audio, :video, :file, :location, :fallback, :share, :story_mention]
|
||||
enum file_type: [:image, :audio, :video, :file, :location, :fallback, :share, :story_mention, :contact]
|
||||
|
||||
def push_event_data
|
||||
return unless file_type
|
||||
return base_data.merge(location_metadata) if file_type.to_sym == :location
|
||||
return base_data.merge(fallback_data) if file_type.to_sym == :fallback
|
||||
return base_data.merge(contact_metadata) if file_type.to_sym == :contact
|
||||
|
||||
base_data.merge(file_metadata)
|
||||
end
|
||||
@@ -106,6 +107,12 @@ class Attachment < ApplicationRecord
|
||||
}
|
||||
end
|
||||
|
||||
def contact_metadata
|
||||
{
|
||||
fallback_title: fallback_title
|
||||
}
|
||||
end
|
||||
|
||||
def should_validate_file?
|
||||
return unless file.attached?
|
||||
# we are only limiting attachment types in case of website widget
|
||||
|
||||
Reference in New Issue
Block a user