Events Webhook

Our Events Webhook lets you stay up to date with Cord activity in your app. Choose which events you want to receive and where we should send them to. Run your own analytics, integrate with tools like Slack, or even build your own AI chatbot assistant...


Tell us what events to send and where #

You can select which events to receive and where we should send them on the Cord Console. Log in to your application and go to the Events tab.

When you give us your Events Webhook endpoint, we will attempt to verify the URL before saving it to your application. You can also set your endpoint via REST API.


Verify incoming events #

To make sure that requests hitting your endpoint are really from Cord, verify the incoming request's signature using your app secret.

Each request has a X-Cord-Signature header set which you should be able to match with a signature you create from the incoming event, using a HMAC-SHA256 keyed hash and your application's secret.

Node.js:
import { createHmac } from 'crypto';

const cordTimestamp = req.header('X-Cord-Timestamp');
const cordSignature = req.header('X-Cord-Signature');

const bodyString = JSON.stringify(req.body);
const verifyStr = cordTimestamp + ':' + bodyString;
const hmac = createHmac('sha256', <YOUR_CORD_APPLICATION_SIGNING_SECRET>);
hmac.update(verifyStr);
const incomingSignature = hmac.digest('base64');

if (cordSignature !== incomingSignature) {
  throw new Error("Unable to verify signature")
} else {
  // process event
}
import { createHmac } from 'crypto';

const cordTimestamp = req.header('X-Cord-Timestamp');
const cordSignature = req.header('X-Cord-Signature');

const bodyString = JSON.stringify(req.body);
const verifyStr = cordTimestamp + ':' + bodyString;
const hmac = createHmac('sha256', <YOUR_CORD_APPLICATION_SIGNING_SECRET>);
hmac.update(verifyStr);
const incomingSignature = hmac.digest('base64');

if (cordSignature !== incomingSignature) {
  throw new Error("Unable to verify signature")
} else {
  // process event
}
Copy

Event Structure #

All events have the following common properties at the top level of the payload:


type #

required
string
The type of event. The contents of the event property will vary depending on the event type. See https://docs.cord.com/reference/events-webhook#Events-2 for more detail about the body of each event type.

timestamp #

required
string
The time at which this event was sent.

applicationID #

required
string
The ID for the application this event belongs to.

event #

required
WebhookPayloads[T]
The body of the event, which will vary depending on event type. See https://docs.cord.com/reference/events-webhook#Events-2 for more detail about the body of each event type.

Events #

Detailed information about each available event and its specific body:

Type 
Description 
thread-message-added
A new Cord message was added
notification-created
A new Cord notification was created
url-verification
Verifies ownership of an events webhook URL

Ask Cordy