Skip to main content

user.session.result

Overview

When a check-in analysis is completed, our platform will send a notification to your specified HTTPS URL. This notification will contain essential information about the check-in, allowing you to take further actions or integrate the results into your systems seamlessly.

Webhook Payload

The webhook will POST a JSON payload to the HTTPS endpoint you've configured in your admin dashboard or via API. Here's the structure of the payload:

{
"event": "session_analysis_complete",
"timestamp": "2024-03-07T12:34:56Z",
"data": {
"sessionID": "abc123xyz",
"externalUserID": "ok_demo123"
}
}

Configuring Your Webhook URL

Ensure that your endpoint is set up to accept POST requests and can handle JSON payloads.

Handling Webhook with Node.js

To process the webhook notification in a Node.js environment, you can use the Express framework for simplicity. Below is a basic example that outlines how to set up an endpoint to receive and parse the webhook payload:

const express = require("express");
const bodyParser = require("body-parser");

const app = express();
const port = 3000;

// Middleware to parse JSON bodies
app.use(bodyParser.json());

// Webhook endpoint
app.post("/webhook", (req, res) => {
console.log("Received webhook:", req.body);

// Extract the session ID from the payload
const sessionId = req.body.data.sessionId;

// Implement your logic here based on the session ID
// For example, retrieving session details from your database

res.status(200).send("Webhook received");
});

app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
});

This example assumes you have Node.js and Express installed. Replace /webhook with the path you plan to configure for your webhook URL. This script logs the received webhook and extracts the sessionID from the payload for further processing.

Ensure to replace the logic inside the POST handler with your specific processing logic, such as fetching more details based on the sessionID or triggering other actions within your system.