From 1891e87d035c235550b5889da585e166cf49502f Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 19 Apr 2015 14:48:12 -0400 Subject: Add Postmark integration (inbound emails for task creation) --- app/Controller/Webhook.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/Controller') diff --git a/app/Controller/Webhook.php b/app/Controller/Webhook.php index ef79379f..afa0543a 100644 --- a/app/Controller/Webhook.php +++ b/app/Controller/Webhook.php @@ -100,4 +100,20 @@ class Webhook extends Base echo $result ? 'PARSED' : 'IGNORED'; } + + /** + * Handle Postmark webhooks + * + * @access public + */ + public function postmark() + { + if ($this->config->get('webhook_token') !== $this->request->getStringParam('token')) { + $this->response->text('Not Authorized', 401); + } + + $result = $this->postmarkWebhook->parsePayload($this->request->getJson() ?: array()); + + echo $result ? 'PARSED' : 'IGNORED'; + } } -- cgit v1.2.3