PrestoDoctor / griddler-sparkpost

SparkPost adapter for Griddler
MIT License
6 stars 4 forks source link

Sparkpost settings for relay webhook #2

Open scott opened 8 years ago

scott commented 8 years ago

I am trying to set this up and have found it is not very clear how to configure the Sparkpost UI to work with griddler. I put in the correct url for my email_processor but I am not sure what else I need to do. Which items do I need checked? When I go to create the webhook the sample payload generates an exception. Any ideas?

Started POST "/email_processor" for 54.244.54.128 at 2016-06-29 07:40:47 -0600
Cannot render console from 54.244.54.128! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Griddler::EmailsController#create as JSON
  Parameters: {"_json"=>[{"msys"=>{}}], "email"=>{"_json"=>[{"msys"=>{}}]}}
Completed 500 Internal Server Error in 72ms (ActiveRecord: 0.0ms)

NoMethodError (undefined method `[]' for nil:NilClass):
  griddler-sparkpost (0.0.3) lib/griddler/sparkpost/adapter.rb:17:in `normalize_params'
  griddler-sparkpost (0.0.3) lib/griddler/sparkpost/adapter.rb:12:in `normalize_params'
  griddler (1.3.1) app/controllers/griddler/emails_controller.rb:17:in `normalized_params'
  griddler (1.3.1) app/controllers/griddler/emails_controller.rb:3:in `create'
mfkp commented 8 years ago

Sorry about the slow reply, was on vacation.

Perhaps sparkpost made some changes with the way they test webhooks? Although an empty email missing parameters doesn't seem like the most useful test.

I'm actually not using this adapter anymore, I switched to different email provider after some deliverability issues, so it's a bit harder for me to test now.

It looks like you would just need to add a check for when certain required parameters are missing and return a 200 OK in response.

Did you make any progress on this @scott?