FIX: SES webhook wasn't parsing the message

This commit is contained in:
Régis Hanol 2019-03-19 11:39:41 +01:00
parent 6d7c0c8f13
commit 31e06dbcd2
2 changed files with 10 additions and 4 deletions

View File

@ -4,7 +4,7 @@ module Jobs
sidekiq_options retry: false
def execute(args)
return unless raw = args[:raw].presence
return unless raw = args[:raw].presence
return unless json = args[:json].presence
return unless subscribe_url = json["SubscribeURL"].presence

View File

@ -4,11 +4,17 @@ module Jobs
sidekiq_options retry: false
def execute(args)
return unless raw = args[:raw].presence
return unless raw = args[:raw].presence
return unless json = args[:json].presence
return unless message = json["Message"].presence
return unless message["notificationType"] == "Bounce"
message = begin
JSON.parse(message)
rescue JSON::ParserError
nil
end
return unless message && message["notificationType"] == "Bounce"
return unless message_id = message.dig("mail", "messageId").presence
return unless bounce_type = message.dig("bounce", "bounceType").presence