From 2493fd1bd670bdd274209caa58ac5314dc94f9e2 Mon Sep 17 00:00:00 2001 From: william Date: Wed, 27 Sep 2017 12:26:25 +0100 Subject: [PATCH] Updating Webhook Processing --- README.md | 16 ++++++++++++++-- classes/controller/webhook.php | 12 ------------ classes/webhook.php | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) delete mode 100644 classes/controller/webhook.php diff --git a/README.md b/README.md index 36b3c43..fd19021 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,20 @@ You can call the send() function to send an email. ## Webhooks -You can configure a Webhook receiving URL witihn Postal. It should be routed to: +You can configure a Webhook receiving URL within Postal. You need to create a controller within your FuelPHP project that calls: +```php +\Synergitech\Postal\Webhook::ProcessWebhook(); ``` -https://yourapp.io/synergitech/postal/webhook/appmail + +Example Controller file (be sure to allow unauthenticated requests to pass to this function): + +```php +class Controller_Webhook extends \Controller_Rest +{ + public function action_postal() + { + \Synergitech\Postal\Webhook::ProcessWebhook(); + } +} ``` diff --git a/classes/controller/webhook.php b/classes/controller/webhook.php deleted file mode 100644 index e1c7f03..0000000 --- a/classes/controller/webhook.php +++ /dev/null @@ -1,12 +0,0 @@ -send(true); } else { \Log::warning("No Payload sent from Postal"); - $response = new \Response('No payload', 498); + $response = new \Response('No payload', 400); $response->send(true); exit; }