How to connect to webhook

Hi there,
I’m pretty new with webhook and apologize if my question sounds trivial.

I have read a post where it confirmed that KEAP offers REST Hook, and have head to the API documentation provided. I just would like to confirm the following thing. If I would like to retrieve data from KEAP API with an event-driven trigger, I would need to create a hook subscription and list the events that I would like to listen to, then to integrate it with my system, do I just connect to it the same way as how I would need to when connecting to KEAP API?

Thank you!

Good morning Michellia!

The resthook subscription is an outbound call from our service to yours, so you’ll have to set up an endpoint to receive the calls on a publicly-available server and process them. If you request a subscription for “contact.edit”, then each time a Contact record is changed you will get a payload at your endpoint that provides the id of the affected Contact, which you could then use to make further calls to retrieve the changed record.


  • Tom Scott
    Keap API Engineer

Hi, thank you very much for the reply and explanation!
I would also like to know if there’s any sample code or instruction on how to set up resthook on my end? I am using CakePHP/PHP

I unfortunately don’t use PHP much myself, but we have a small Node Express script that we run internally when testing them that illustrates how it works:

const express = require('express')

const app = express()'/listener', function(req, res) {
  var secret = req.header('X-Hook-Secret')
  if (secret) {
    // If this is the initial "verification" request containing a hook secret, capture and reply with it to validate
    console.log("X-Hook-Secret: " + secret)

    res.header('X-Hook-Secret', secret)
  } else {
    // Otherwise you've just received a payload for an event, so do something with it
    var timestamp = new Date()
    var hook = JSON.stringify(req.body, null, 2)

app.listen(8080, function() {
  console.log(`Listening for rest hooks on port 8080!`)

Note that you would have to deploy something like this somewhere to be able to make the subscription with a valid URL; our service can’t resolve your localhost.