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.

![CleanShot 2025-06-27 at 20 48
12](https://github.com/user-attachments/assets/b5a75796-6937-49bc-b689-7d04f4ea5d09)
This commit is contained in:
Muhsin Keloth
2025-06-30 11:35:32 +05:30
committed by GitHub
parent ee4a0d4486
commit b1893c7d96
5 changed files with 69 additions and 3 deletions

View File

@@ -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