lib/emailbutler/webhooks/mappers/sendgrid.rb in emailbutler-0.8.4 vs lib/emailbutler/webhooks/mappers/sendgrid.rb in emailbutler-0.8.5
- old
+ new
@@ -6,21 +6,17 @@
class Sendgrid
DELIVERABILITY_MAPPER = {
'processed' => 'processed',
'delivered' => 'delivered',
'open' => 'delivered',
- 'click' => 'delivered',
- 'deferred' => 'failed',
- 'bounce' => 'failed',
- 'dropped' => 'failed',
- 'spamreport' => 'failed'
+ 'click' => 'delivered'
}.freeze
def call(payload:)
payload['_json'].filter_map { |message|
message.stringify_keys!
message_uuid = message['smtp-id'] || message['sg_message_id']
- status = DELIVERABILITY_MAPPER[message['event']]
+ status = DELIVERABILITY_MAPPER[message['event']] || Emailbutler::Message::FAILED
next if message_uuid.nil? || status.nil?
{
message_uuid: message_uuid,
status: status,