Listen to Webhooks

Keep your database state up-to-date by listening to our webhooks and filtering the changed data. Register a webhook on the webhook page for finished syncs.

Learn how to use webhooks in development and how to authenticate them here.

React to webhooks

After receiving a webhook, you can use the integration_id in the body to fetch updated data from Kombo into your database. Do that by calling the endpoints you are interested in while providing the updated_after query parameter. This parameter is available for all Kombo GET endpoints. The endpoints are still paginated when using the updated after filter.

We recommend that you persist the timestamp of your last fetching process in your database and use that as the updated_after filter.

Here is an example of how this could be implemented in Node.js:

async function reactToSyncFinishedWebhook(options: {
  lastSyncedAt: Date
  integrationId: string
}) {
  let cursor
  do {
    const resp = axios.get('https://api.kombo.dev/v1/hris/employees', {
      headers: {
        Authorization: KOMBO_API_KEY,
        'X-Integration-Id': options.integrationId,
      },
      params: {
        cursor: cursor,
        updated_after: options.lastSyncedAt.toISOString(),
      },
    })

    cursor = resp.data.data.next

    // Do something with the data
    // ...
  } while (cursor)
}