Question

I'm using sendgrid's event api which sends a codeblock like this to a postback url of my choice:

Array
(
    [email] => fgdfg@gmail.com
    [timestamp] => 1323698899
    [smtp-id] => <4ee60acf8e3d1_55dd862cf147044@mbjoppa.mail>
    [response] => 250 2.0.0 OK 1323698899 o30s15072o427yhl.103 
    [event] => delivered
)

They don't have XML or JSON and I need to extract the email and event parts of this block.

Any idea how I do this with rails? Basically this block is sent to a postback URL of my choice but I'm not sure how to use it from there.

Was it helpful?

Solution

I never used sendgrid but after a quick look it seems like they are just sending you a standard post request with parameters so you best bet is to define a simple action like the following and see what you get:

def sendgrid_event
  Rails.logger.info(params)

  # chances are that this will contains what you are looking for:
  # params['email']
  # params['event']

end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top