diff --git a/app/services/sms/incoming_message_service.rb b/app/services/sms/incoming_message_service.rb index eb0b5512b..a21f76b58 100644 --- a/app/services/sms/incoming_message_service.rb +++ b/app/services/sms/incoming_message_service.rb @@ -87,7 +87,7 @@ class Sms::IncomingMessageService file_type: file_type(attachment_file.content_type), file: { io: attachment_file, - filename: attachment_file, + filename: attachment_file.original_filename, content_type: attachment_file.content_type } ) diff --git a/app/services/telegram/incoming_message_service.rb b/app/services/telegram/incoming_message_service.rb index 1647623be..7ff7a6155 100644 --- a/app/services/telegram/incoming_message_service.rb +++ b/app/services/telegram/incoming_message_service.rb @@ -105,7 +105,7 @@ class Telegram::IncomingMessageService file_type: file_content_type, file: { io: attachment_file, - filename: attachment_file, + filename: attachment_file.original_filename, content_type: attachment_file.content_type } ) diff --git a/app/services/whatsapp/incoming_message_service.rb b/app/services/whatsapp/incoming_message_service.rb index 1a750b41a..c96e6e771 100644 --- a/app/services/whatsapp/incoming_message_service.rb +++ b/app/services/whatsapp/incoming_message_service.rb @@ -77,7 +77,6 @@ class Whatsapp::IncomingMessageService end def attach_files - message_type = params[:messages].first[:type] return if %w[text button interactive].include?(message_type) attachment_payload = params[:messages].first[message_type.to_sym] @@ -89,9 +88,13 @@ class Whatsapp::IncomingMessageService file_type: file_content_type(message_type), file: { io: attachment_file, - filename: attachment_file, + filename: attachment_file.original_filename, content_type: attachment_file.content_type } ) end + + def message_type + params[:messages].first[:type] + end end