From f190be9e2d4d285fb71d84e5d3884206067cf7af Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 19 Apr 2015 19:23:42 -0400 Subject: Add Sendgrid integration (incoming email handling) --- app/Controller/Webhook.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/Controller') diff --git a/app/Controller/Webhook.php b/app/Controller/Webhook.php index 06bfcd4e..667c5087 100644 --- a/app/Controller/Webhook.php +++ b/app/Controller/Webhook.php @@ -128,4 +128,18 @@ class Webhook extends Base echo $this->mailgunWebhook->parsePayload($_POST) ? 'PARSED' : 'IGNORED'; } + + /** + * Handle Sendgrid webhooks + * + * @access public + */ + public function sendgrid() + { + if ($this->config->get('webhook_token') !== $this->request->getStringParam('token')) { + $this->response->text('Not Authorized', 401); + } + + echo $this->sendgridWebhook->parsePayload($_POST) ? 'PARSED' : 'IGNORED'; + } } -- cgit v1.2.3