Skip to main content
Version: 1.18.1

Websockets and webhooks

Endpoints

OMNI Platform has the ability to send events to third-party services using two types of endpoints: websocket or webhook.

Websockets

Create a websocket endpoint

Click on the + Create button in the upper right corner of the Endpoints page. In the opened tab select the endpoint type (Websocket), specify the name of the endpoint and click Create.

Detailed information for each websocket can be viewed in its card. To open the card, click on the websocket line on the Endpoints page.

note

In the upper left corner of the card there is a button with an abbreviated identifier (endpoint_id). When you hover over the button, the full version of the identifier will be displayed, and when you click on the button, the identifier will be copied to the clipboard.

Configure sending events via websocket

Below is a web socket connection using the example of the Postman HTTP client:

  1. Download and install Postman.

  2. Select file -> new -> WebSocket in the client interface.

  3. Specify the request URL ws://$DOMAIN/event-service/ws?endpoint_id=<endpoint_id> for transmitting events via websocket.

    ATTENTION!

    To connect via websocket, use endpoint_id, listed in the dashboard on the Endpoints page. You can also request endpoint_id via the GraphQL API (See Event service endpoints in the API Reference section).

    To filter events sent via websocket, link an endpoint to the event filter, otherwise all events will be received.

  4. The connection is established, events are sent to the server.

    note

    Since the Platform and Agent data are synchronized on average once per minute, the following situation can occur:

    If within an average of 1 minute after deleting a profile from the database, the person, who this profile belonged to, gets into the camera’s field of view, the Agent generates an identification event and sends it to the Platform. Since such a profile no longer exists on the Platform, the Platform cannot send such an event via websocket. Such "lost" events can only be displayed through the GraphQL API of the Platform.

Example of an event sent via websocket:

{"type": "identification", 
"activity_id": "69410e11-d3f6-449c-927f-cea210f0e326",
"camera": {"id": "72aa3a70-0fc1-46f1-8a8e-eb50cd4f13a3", "type": "IP", "title": "rtsp://192.168.122.150/stream", "stream": "rtsp://192.168.122.150/stream", "real_name": null, "agent_id": "a593c1be-d13e-4244-8179-1df0a6b725f7"},
"candidates": [{
"profile": {
"id": "d96fb010-8da5-49a6-b571-b48cb241a923",
"age": 30,
"gender": "MALE",
"avatar_id": "e5a1f9b6-9e10-4ac2-8723-bbae0b9d9200",
"main_sample_id": "e5a1f9b6-9e10-4ac2-8723-bbae0b9d9200",
"sample_link": "http://op-v1-18-0-rc1.platform.kuber2.3divi.ru/get-image/e5a1f9b6-9e10-4ac2-8723-bbae0b9d9200"},
"profile_groups": [{"id": "82e7d0c3-6e69-425b-ab79-faa19c2d9fe7", "color": "orange.400"}],
"confidence": 0.9359086751937866}],
"event": {
"id": "b4c32a55-685e-4055-9716-aeda8c892c84",
"detection_date": "2024-05-29 10:48:27.364000+00:00",
"image": "ddf08b27-1bc6-409f-9b27-f099268453cb",
"original_image": "3841d16d-34c5-48dd-9135-f39126477078",
"image_link": "http://op-v1-18-0-rc1.platform.kuber2.3divi.ru/event-service/get-image/ddf08b27-1bc6-409f-9b27-f099268453cb", "original_image_link": "http://op-v1-18-0-rc1.platform.kuber2.3divi.ru/event-service/get-image/3841d16d-34c5-48dd-9135-f39126477078"}}

Webhooks

Create a webhook endpoint

Click on the + Create button in the upper right corner of the Endpoints page. In the opened tab select the endpoint type (Webhook), specify the name of the endpoint and click Create.

Detailed information on each webhook can be viewed in its card. To open the card, click on the webhook line on the Endpoints page.

note

In the upper left corner of the card there is a button with an abbreviated identifier (endpoint_id). When you hover over the button, the full version of the identifier will be displayed, and when you click on the button, the identifier will be copied to the clipboard.

Example of an event sent via webhook:

{
"type": "identification",
"activity_id": "acf8120f-5047-4c15-80f5-4f5b56d250c2",
"camera": {
"id": "72aa3a70-0fc1-46f1-8a8e-eb50cd4f13a3",
"type": "IP",
"title": "rtsp://192.168.122.150/stream",
"stream": "rtsp://192.168.122.150/stream",
"real_name": null,
"agent_id": "a593c1be-d13e-4244-8179-1df0a6b725f7"
},
"candidates": [
{
"profile": {
"id": "d96fb010-8da5-49a6-b571-b48cb241a923",
"age": 30,
"gender": "MALE",
"avatar_id": "e5a1f9b6-9e10-4ac2-8723-bbae0b9d9200",
"main_sample_id": "e5a1f9b6-9e10-4ac2-8723-bbae0b9d9200",
"sample_link": "http://op-v1-18-0-rc1.platform.kuber2.3divi.ru/get-image/e5a1f9b6-9e10-4ac2-8723-bbae0b9d9200"
},
"profile_groups": [
{
"id": "82e7d0c3-6e69-425b-ab79-faa19c2d9fe7",
"color": "orange.400"
}
],
"confidence": 0.9436722993850708
}
],
"event": {
"id": "348e726d-d78d-4a7f-b5b4-e6b3cf956b78",
"detection_date": "2024-05-29 09:44:15.727000+00:00",
"image": "f847fd16-8ca3-408f-9927-aac80f7e2f89",
"original_image": "5e46d1d7-ca5b-4804-9c7e-6022f5a561b7",
"image_link": "http://op-v1-18-0-rc1.platform.kuber2.3divi.ru/event-service/get-image/f847fd16-8ca3-408f-9927-aac80f7e2f89",
"original_image_link": "http://op-v1-18-0-rc1.platform.kuber2.3divi.ru/event-service/get-image/5e46d1d7-ca5b-4804-9c7e-6022f5a561b7"
}
}

Filters and sorts

Filters
  • By endpoint ID
  • By endpoint type
Sorts
  • By creation date

To filter/sort endpoints, click Add filter / Add sort and select one of the parameters in the drop-down list. The selected filter and sort will then appear at the top left of the page.

Event filters

Before sending to attached endpoints (websockets or webhooks), events can be filtered by the following parameters:

  • by cameras and OMNI-agents from which events come;
  • by watchlists to which a person from the event was added;
  • by event type.

Create event filter

Click + Create in the top right corner of the Event filters page. In the opened tab specify the name of the filter, the endpoint to which events will be sent through this filter, and the filtering parameters for sent events. After filling, click Create.

You can view and edit the data of the created filter or delete it in the filter card. To open a card, click on the filter bar on the Event filters page.

Filters and sorts

Filters
  • By event filter IDs
Sorts
  • By creation date
  • By modification date

To filter/sort event filters, click Add filter / Add sort and select one of the parameters in the drop-down list. The selected filter and sort will then appear at the top left of the page.