fix: Support location messages in Twilio WhatsApp integration (#11830)
Fixes location messages not appearing in conversations when sent via Twilio. Location messages were being filtered out due to empty body content and missing parameter handling. 
This commit is contained in:
@@ -17,6 +17,7 @@ class Twilio::IncomingMessageService
|
||||
source_id: params[:SmsSid]
|
||||
)
|
||||
attach_files
|
||||
attach_location if location_message?
|
||||
@message.save!
|
||||
end
|
||||
|
||||
@@ -155,4 +156,17 @@ class Twilio::IncomingMessageService
|
||||
Rails.logger.info "Error downloading attachment from Twilio: #{e.message}: Skipping"
|
||||
nil
|
||||
end
|
||||
|
||||
def location_message?
|
||||
params[:MessageType] == 'location' && params[:Latitude].present? && params[:Longitude].present?
|
||||
end
|
||||
|
||||
def attach_location
|
||||
@message.attachments.new(
|
||||
account_id: @message.account_id,
|
||||
file_type: :location,
|
||||
coordinates_lat: params[:Latitude].to_f,
|
||||
coordinates_long: params[:Longitude].to_f
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user