A webhook is a standard mechanism for implementing HTTP callbacks. Using a webhook enables code under your control to be executed when an event occurs on your Postcoder account.

For example, you could automatically send a Slack message to your accounts department if you run low on credits, or flash a Phillips Hue bulb if a request is denied because it originated from an unregistered IP Address.

You can host the webhook yourself or use a service such as Zapier to create a workflow.

You can enable webhooks, set the target URL for your webhook and send a test request in your Postcoder admin area

Example webhook request

All webhooks requests are sent via POST and contain a JSON encoded array of messages. Typically only one message is sent per request, however it is possible that more than one would be sent at a time.

        "message": {
            "type_id": "1",
            "type_name": "Security",
            "event_id": 3,
            "subject": "Postcoder - IP Address restricted by the public access security setting",
            "message": "Account:  Allies Computing\r\n\r\n\r\nHello,\r\n\r\nAn IP address using your service via the public access security settings has been restricted by the '5 lookup in a 5 minute period' setting,  12 times today.\r\n\r\nThe IP address is:\r\n\r\nIf this IP is known to you and should be granted unrestricted access to your service, it should be associated with your account.\r\n\r\nReview and edit your settings at https:\/\/admin.postcoder.com\/web\/security\r\n\r\nView all account errors at https:\/\/admin.postcoder.com\/user\/stats\r\n\r\nIf you have any questions, please let us know.\r\n           \r\nThe Allies Team\r\n\r\n\r\nFor help and support:\r\n\r\n01508 494488\r\nsupport@alliescomputing.com\r\nhttp:\/\/www.alliescomputing.com\/support\r\n",
            "priority": 3

Request field descriptions

Field name Data type Description Example
type_id Integer Numeric identifier for type of alert (listed below) 1
type_name String Text description of type of alert Security
event_id Integer Numeric unique identifier for alert 3
subject String Short text description of the alert, same as content that would be sent in subject title of email alerts Postcoder - IP Address restricted by the public access security setting
message String Full text of the alert, same as content that would be sent in body of email alerts Account: Allies Computing...
priority Integer Numeric priority level, 1-5 with 1 being highest and 5 being lowest. 3

List of types

ID Name Description
1 Security Related to security settings on your account, like request from an unregistered IP address.
2 Account General account alerts such as about to run out of credits or higher than normal usage on your account.