NSWDPC\Datawrapper\WebHookController
Controller for handling webhook submissions from Datawrapper To create a webhook URL, see the README.md
- Author: James <james.ellis@dpc.nsw.gov.au>
Synopsis
class WebHookController
extends Controller
{
- // members
- private static boolean $webhooks_enabled = true;
- private static string $webhooks_random_code = '';
- private static array $allowed_actions = ;
- // methods
- public string Link()
- public static string|bool getWebookURL()
- protected string getResponseBody()
- protected HTTPResponse serverError()
- protected HTTPResponse clientError()
- protected HTTPResponse returnOK()
- public HTTPResponse index()
- protected bool webhooksEnabled()
- protected bool webhookRandomCodeMatch()
- public void submit()
Hierarchy
Extends
- SilverStripe\Control\Controller
Members
private
- $allowed_actions
- $webhooks_enabled
- $webhooks_random_code
Methods
protected
- clientError() — Client (being Mailgun user agent) has done something wrong
- getResponseBody() — Return the response body for a webhook submission The two keys are 'success' being a boolean, count being the number of items changed
- returnOK() — All is good
- serverError() — We have done something wrong
- webhookRandomCodeMatch() — Test whether the random code sent in the request matches what is configured
- webhooksEnabled() — Returns whether webhooks are enabled in Configuration
public
- Link() — Return link to this controller
- getWebookURL() — Return the URL (absolute) for webhook submissions If webhooks are not enabled, this will return boolean false
- index() — Ignore requests to /
- submit() — Primary handler for submitted webooks