Saving Mandrill webhook to database

224 views Asked by At

Im having trouble understanding how to process the data sent to my post route from the mandrill webhook.

I have set up my route and registered it in the mandrill settings. Sending a test from the dashboard works fine (webhook is triggered on send, open, and hard_bounce):

Route::post('/mailApi/webhooks', 'ContactController@postMandrill'); 

Currently, I'm just trying to ensure that I can receive the webhook and make sure that I understand the format.

I have created a function for in my ContactController for testing purposes:

public function postMandrill(){

        $data = Input::get("mandrill_events");
        $mandrill = new Mandrillemail;
        $mandrill->event = $data;
        $mandrill->msg_subject = 'test';
        $mandrill->save();
}

When I send an email to trigger the webhook, I get no errors and nothing is saved in the database. It seems like the route isn't touched at all. What do I need to do to access the webhook?

0

There are 0 answers