Skip to main content

How SmartAI delivers results

SmartAI does not push results to a URL. Instead, it stores completed assessment events in a queue. Your server polls the queue — fetching and clearing events on a schedule.
You need to set up two things:
  1. The env vars on your server
  2. A background poller that runs every 30 seconds

Step 1 — Environment variables

Add these two lines to your server .env file:
Both keys must be on your server only. Never add them to NEXT_PUBLIC_ variables or commit them to git. If your secret key is ever leaked, rotate it immediately from the dashboard.

Step 2 — Initialise the client

Create one AssessmentClient instance. You can do this once globally or once per poll call — both are fine.

Step 3 — What to pass to getWebhookEvents()

number
default:"50"
How many events to fetch in one call. Maximum is 100.
Start with 50. If you have a very high assessment volume (hundreds per hour), increase to 100.
number
A Unix timestamp in milliseconds. Only returns events that were stored after this time.
Leave this out for normal polling — you don’t need it unless you’re backfilling a time window.

What comes back

array
Array of assessment result objects. Each one has all the candidate’s result data. See Webhook Event Schema for every field.
number
How many events are still waiting in the queue after this batch.
  • 0 → queue is empty, nothing more to process
  • > 0 → there are more events — call getWebhookEvents again to get the next batch

Step 4 — What to pass to acknowledgeWebhookEvents()

string[]
required
An array of eventId strings — one for each event you successfully saved to your database.
Events you do not acknowledge stay in the queue and are returned again on the next poll.

What comes back

number
The number of events that were removed from the queue.

Step 5 — Complete poller setup

Two event types come through the same queue. Your poller handles both: Copy this into your server. Place it in a file like src/jobs/pollAssessments.ts and call it when your server starts.
Node.js
Python
Call it when your FastAPI server starts:
Python (FastAPI startup)
Call it when your Express server starts:

Step 6 — Save function (what fields to store)


All options at a glance

getWebhookEvents() options

acknowledgeWebhookEvents() options

Fields returned in each event

See the full Webhook Event Schema for every field with detailed descriptions.

Polling interval guide

Do not poll faster than every 5 seconds. The platform will rate-limit your calls.

Common configuration mistakes