How To Get Started With Webhooks

A Webhook is a HTTP POST call that will send a message to your server or application. This is used for deeper integration in your workflow.

REGISTER FIRST

If you don't have an account yet, go ahead and create one for free.


Register Now

CREATE WEBHOOK

For us to send you messages we need to know where to send our POST message. Configuration is done in the Notifications section.


API:

curl --get "https://api.tokendns.co/v1/notifications" \
  -d apikey=${apikey} \
  -d action=add \
  -d provider=webhook \
  -d webhook=${webhook_url}

CREATE ENDPOINT

How do you receive the messages? You need to have a service exposed to the internet which we can reach. The easiest example is a simple php script.


PHP Example:

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

Payload Example:

{
  "domain": "www.tokendns.co",
  "type": "A",
  "content": "188.166.134.64",
  "message": "Record www.tokendns.co reserved for A with 188.166.134.64"
}

FINISH!

Now you can automate your system when a dns record changed. Check out our Blog for more information.

Join our newsletter