LeKoala\Mailgun\MailgunController
Provide extensions points for handling the webhook
- Author: LeKoala <thomas@lekoala.be>
Synopsis
class MailgunController
extends Controller
{
- // constants
- const TYPE_CLICKED = 'clicked';
- const TYPE_COMPLAINED = 'complained';
- const TYPE_DELIVERED = 'delivered';
- const TYPE_OPENED = 'opened';
- const TYPE_PERMANENT_FAIL = 'permanent_fail';
- const TYPE_TEMPORARY_FAIL = 'temporary_fail';
- const TYPE_UNSUBSCRIBED = 'unsubscribed';
- // members
- protected integer $eventsCount = 0;
- protected integer $skipCount = 0;
- private static array $allowed_actions = ;
- private static array $dependencies = ;
- public LoggerInterface $logger;
- // methods
- public void index()
- public void test()
- public string configure_inbound_emails()
- public void incoming()
- protected bool verifyCall()
- protected void processPayload()
- public CacheInterface getLogger()
Hierarchy
Extends
- SilverStripe\Control\Controller
Tasks
Line | Task |
---|---|
110 | : use routing to implement this |
184 | implement this |
198 | parse payload properly |
Constants
Name | Value |
---|---|
TYPE_CLICKED | 'clicked' |
TYPE_COMPLAINED | 'complained' |
TYPE_DELIVERED | 'delivered' |
TYPE_OPENED | 'opened' |
TYPE_PERMANENT_FAIL | 'permanent_fail' |
TYPE_TEMPORARY_FAIL | 'temporary_fail' |
TYPE_UNSUBSCRIBED | 'unsubscribed' |
Members
private
- $allowed_actions
- $dependencies
—
array
Inject public dependencies into the controller
protected
- $eventsCount
- $skipCount
public
- $logger — LeKoala\Mailgun\Psr\Log\LoggerInterface
Methods
protected
- processPayload() — Process data
- verifyCall() — A receiving URI must be public, so webhooks should be secured with a signature, time stamp and token to create a hash map using an API key to verify that the data is coming from the developer’s ESP. Users should program their application to check that hash map and compare it to that of the ESP, and then allow the post to be made only if it matches.
public
- configure_inbound_emails()
- getLogger() — Get logger
- incoming() — Handle incoming webhook
- index()
- test() — You can also see /resources/webhook.txt