How to add a Webhook notification to TokenDNS?


What is a Webhook?

A Webhook is a HTTP POST call that will send a message to your server or application. This is mainly used for deeper integrations. Lets say you have a DNS caching service running and need to flush the record that just got changed to have immediately access.
But basically everything is possible with a Webhook and thats why it was important to us that its available from the beginning.

What do I need to use a Webhook with TokenDNS?

First you need to have a HTTP/HTTPS endpoint where we can send the POST message to. Most of the time this is a webserver which should offer SSL.

How does the payload look like?

  "domain": "",
  "content": "",
  "message": "Record reserved for A with"

Example Webhook in PHP:

$tokendns = json_decode(file_get_contents('php://input'));
$domain = $tokendns->{domain};
$content = $tokendns->{content};
$message = $tokendns->{message};
// do something....

This is a very small example and should never go into production like this, but it will makes it very easy for you to integrate the webhook in your services.

How to enable a Webhook Notifications?

When you have your Webhook and script ready. Just head over to the BlaBlaDNS settings and select Webhook from the pulldown menu. Add your endpoint and be ready for some incoming data.


I want to use the API!

I hear you and like it. Easy as you know it:

curl --get "" \
  -d apikey=${apikey} \
  -d action=add
  -d provider=webhook
  -d webhook=${webhook_url}

Leave a Reply

Your email address will not be published. Required fields are marked *