diff --git a/app/models/concerns/smooch_messages.rb b/app/models/concerns/smooch_messages.rb index a8df490b0f..6b09835376 100644 --- a/app/models/concerns/smooch_messages.rb +++ b/app/models/concerns/smooch_messages.rb @@ -461,7 +461,7 @@ def send_custom_message_to_user(team, uid, timestamp, message, language) date = I18n.l(Time.at(timestamp), locale: language, format: :short) message = self.format_template_message('custom_message', [date, message.to_s.gsub(/\s+/, ' ')], nil, message, language, nil, true) if platform == 'WhatsApp' response = self.send_message_to_user(uid, message, {}, false, true, 'custom_message') - success = (response.code.to_i < 400) + success = (response && response.code.to_i < 400) success end end