FIX: sparkpost webhooks support

This commit is contained in:
Régis Hanol 2016-10-17 11:26:49 +02:00
parent d8722e7a87
commit 3949c24f80
3 changed files with 2 additions and 4 deletions

View File

@ -91,7 +91,7 @@ class WebhooksController < ActionController::Base
def sparkpost
events = params["_json"] || [params]
events.each do |event|
message_id = event["msys"]["message_event"]["campaign_id"] rescue nil
message_id = event["msys"]["message_event"]["message_id"] rescue nil
bounce_class = event["msys"]["message_event"]["bounce_class"] rescue nil
next unless message_id && bounce_class

View File

@ -139,8 +139,6 @@ module Email
@message.header['X-MJ-CustomID'] = @message.message_id
when "smtp.mandrillapp.com"
@message.header['X-MC-Metadata'] = { message_id: @message.message_id }.to_json
when "smtp.sparkpostmail.com"
@message.header['X-MSYS-API'] = { campaign_id: @message.message_id }.to_json
end
# Suppress images from short emails

View File

@ -109,7 +109,7 @@ describe WebhooksController do
"msys" => {
"message_event" => {
"bounce_class" => 10,
"campaign_id" => message_id
"message_id" => message_id
}
}
}]