Articles on: Blacklists

Blacklists Webhook

Using the blacklist webhook



The webhook sends a POST request with JSON data inside the payload parameter.

An example of the JSON data:

{
  "id": "5bf6c13e3f0bc1621c3e1ee3",
  "tags": null,
  "list": [
    {
      "target": "1.0.0.4",
      "blacklist": "dyna.spamrats.com",
      "status": "DOWN"
    },
    {
      "target": "1.0.0.4",
      "blacklist": "all.spamrats.com",
      "status": "DOWN"
    },
    {
      "target": "1.0.0.5",
      "blacklist": "dyna.spamrats.com",
      "status": "DOWN"
    },
    {
      "target": "1.0.0.3",
      "blacklist": "dyna.spamrats.com",
      "status": "OK"
    }
  ]
}


Sample PHP script to read the webhook data:

<?php

$data = json_decode($_POST['payload'], true);

$id = $data['id'];

foreach($data['list'] as $listing) {
    if($listing['status' == 'DOWN']) echo $listing['target'].' is listed on '.$listing['blacklist'];
    else echo $listing['target'].' has been delisted on '.$listing['blacklist'];
}
?>

Updated on: 23/11/2018

Was this article helpful?

Share your feedback

Cancel

Thank you!