React to eventsReceive your first webhook

Receive your first webhook

Set up an endpoint, add a webhook in Imploy and send a test event.

A webhook sends an HTTP POST to your server when something happens in Imploy. This guide gets one working end to end.

Before you start

You need a public HTTPS address that Imploy can reach:

  • HTTPS on port 443, with a public hostname.
  • No username, password or fragment in the URL.
  • Not an imploy.com.au address.

While building, a tunnelling tool that gives your laptop a public HTTPS URL works well.

1. Write an endpoint

It must answer 2xx within 5 seconds. Imploy waits only 2 seconds to connect and doesn't follow redirects.

import express from "express";

const app = express();

app.post("/imploy", express.raw({ type: "application/json" }), (req, res) => {
  const event = JSON.parse(req.body.toString());
  console.log(req.header("X-Imploy-Event-Id"), event.event, event.is_test);
  res.sendStatus(200);
});

app.listen(3000);

The raw body is used above on purpose. You need it unchanged to verify the signature in the next guide.

2. Add the webhook

Open Integrations

In Imploy, go to Settings > Integrations and add a webhook.

Fill it in

Give it a name, your destination URL and at least one event, such as client.created. A secret header is optional.

Send a test

Enable the webhook, then use Test. Imploy sends a sample with is_test set to true.

If the test returns 401 or 403, check the secret header you set. If nothing arrives, check the URL is public and answers within 5 seconds.

3. Try a real event

Create a client in Imploy and watch your endpoint log client.created. The body has the event name, resource, changed_fields and data. See Payloads.

Next, verify the signature so you only trust requests from Imploy.