Webhook Node

Send pipeline metadata to a Web service periodically or when a trigger condition is met

Inputs & Outputs

  • Inputs : 1, Media Format : Any
  • Outputs : 1, Media Format: Same as Input
  • Output Metadata : None

Properties

PropertyValue
webhook_urlPOSTs metadata to this URL directly from the Gateway.

Content-Type : application/json
Content-Encoding : gzip (if compression is True)

ex. https://oefh9238y132.ngrok.io
triggerIf set, this condition is evaluated for every frame and a webhook is sent when it evaluates to True, subject to the minimum time delta as specified below.

The trigger expression must be a valid Dot-notation expression that operates on Pipeline Metadata and evaluates to True or False. See details here.

ex. nodes.annotate_line_counter1.lines.line1.total_objects_crossed_delta > 0
intervalMinimum time, in seconds, between consecutive webhooks.

If a trigger is not specified, webhooks will be sent at this interval.

ex. 10
formatWebhook Format. Options: application_json, form_multipart.

JSON Post sends Frame Metadata as JSON in request body (application/json).

Form Multipart sends Frame Metadata as a JSON file attachment and can send clips and snapshots.

See Webhook Format section below for format details.
json_formatFormat for the JSON sent via the webhook.

Options: dynamic_keys, static_keys

Dynamic Keys uses certain attributes (such as ROI names) as keys, useful for JSON Path operations. Static Keys converts all such attributes to a named static key.
include_frame_metadataAttach frame metadata from the time the trigger happened with the webhook. Only applicable when format is form_multipart.

Boolean.
include_snapshotAttach a snapshot from the time the trigger happened with the webhook. Only applicable when format is form_multipart.

Boolean.
clip_nodeAttach the most recent clip from the named Save Clip node with the webhook. The node must be configured to store clips locally. Delays webhook till a clip is available or timeout is reached.

Ex. clip1
max_media_wait_timeMaximum time (in seconds) to wait until a media clip is available.

Ex. 5
include_clip_metadataAttaches metadata from the clip along with the media.

Boolean.
batchIf true, collects metadata between web hooks, and sends it as a batch. Else sends just a specific frame's metadata, discarding the metadata in between web hooks.

ex. true / false
compressionIf true, enable GZIP content-encoding for the webhook data.

ex. true / false

Note: This is only applied to this Frame's metadata, not any other attachments in case of Form Multipart POST format.
extra_headersComma separated Extra Headers to be added to the web request.

Ex. "Authorization:Bearer xad32248fhsad, X-Extra-Header:Foo"

Webhook Format

JSON POST

When format is set to application_json, the contents of the Frame's metadata (see Frame Metadata section below) are sent as the body of a POST request made to the webhook_url.

Form Multipart POST

When format is set to form_multipart, the POST request to the webhook_url can contain one or more of the following "files" when the corresponding settings are enabled in the node settings.

KeyFileNameFile Contents
metadatameta.json (or meta.json.gz if compression is enabled)Contains the contents of the triggering Frame's Metadata described below.

Maximum 1 per POST request.
snapshotsnapshot.jpgContains the snapshot from the frame when the webhook was triggered.
clip<capture-timestamp>.mp4Media Clip generated by a Save Clip Node
clipmetadata<capture-timestamp>.mp4.jsonMetadata corresponding to the entire Media Clip, in the same format as described below.

Frame Metadata

This section describes the format of each Frame's metadata that is sent in the webhook.

KeyValue
version1 : Dynamic Keys
2 : Static Keys
metaContains Metadata object, a dictionary of timestamp - frame level metadata pairs.
meta.<relative_timestamp>Contains Frame level metadata for a frame with this timestamp (relative to start of stream).

This metadata is a set of key-value pairs containing metadata from each node in the pipeline up until the Webhook node, so exact properties will vary.

If batch property of the Webhook node is set to True, the meta element will contain multiple frame's metadata, each with it's own timestamp.
{
    "version": 1,
    "meta": {
        "0:06:40": {
            "timestamp": "2022-11-04T23:41:34.036574Z",
            "nodes": {
                "video1":{
                  "type": "video_source", 
                  "source_id": "6372b7e6-e5d6-45b8-b31b-c400a3754ff4", 
                  "source_name": "Milestone-AXIS P1455-LE (172.16.0.38) - Camera 1", 
                  "source_type": "stream",     
                  "uri": "rtsp://172.16.0.45:554/live/658040e2-fe47-4d4b-9a27-2217af4c4193"
                },              
                "annotate_presence1": {
                    "type": "annotate_presence",
                    "rois": {
                        "roi1": {
                            "coords": [[1,1], 
                                       [100,100], 
                                       [200,200]],
                            "total_objects": 2,
                            "objects_entered_delta": 1,
                            "objects_exited_delta": 0,
                            "objects_above_max_time_threshold_count": 1,
                            "current_objects_count": 2,
                            "current_objects": {
                                "15069984211300461000": {
                                    "first_seen": 20,
                                    "time_present": 3600
                                },
                                "1506998428100461000": {
                                    "first_seen": 22,
                                    "time_present": 20
                                }                          
                            }
                        }
                    }
                }
            },
            "objects": [
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 236.29208374023438,
                        "height": 15.62222957611084,
                        "left": 339.904052734375,
                        "width": 31.91175079345703
                    },
                    "id": 1506998428100461000,
                    "label": "car"
                },
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 250.60275268554688,
                        "height": 19.088224411010742,
                        "left": 235.5812530517578,
                        "width": 35.78194046020508
                    },
                    "id": 1506998428100461000,
                    "label": "car"
                },
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 447.784912109375,
                        "height": 244.92181396484375,
                        "left": 0,
                        "width": 158.60867309570312
                    },
                    "id": 1506998428100460500,
                    "label": "car"
                },
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 495.3921813964844,
                        "height": 205.00851440429688,
                        "left": 427.19415283203125,
                        "width": 135.38002014160156
                    },
                    "id": 1506998428100460500,
                    "label": "car"
                },
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 518.0147705078125,
                        "height": 194.1524200439453,
                        "left": 239.1914825439453,
                        "width": 158.16836547851562
                    },
                    "id": 1506998428100460500,
                    "label": "car"
                },
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 538.0975952148438,
                        "height": 173.88412475585938,
                        "left": 96.46807098388672,
                        "width": 154.6107940673828
                    },
                    "id": 1506998428100461000,
                    "label": "car"
                }
            ],

        }
    }
}
{
    "version": 2,
    "meta": [
        {
            "relative_timestamp": "0:06:40",
            "timestamp": "2022-11-04T23:41:34.036574Z",
            "nodes": [
                {
                    "id": "video1",
                    "type": "video_source", 
                    "source_id": "6372b7e6-e5d6-45b8-b31b-c400a3754ff4", 
                    "source_name": "Milestone-AXIS P1455-LE (172.16.0.38) - Camera 1", 
                    "source_type": "stream",     
                    "uri": "rtsp://172.16.0.45:554/live/658040e2-fe47-4d4b-9a27-2217af4c4193"
                },              
                {
                    "id": "annotate_presence1",
                    "type": "annotate_presence",
                    "rois": [
                        {
                            "label": "roi1",
                            "coords": [[1,1], 
                                        [100,100], 
                                        [200,200]],
                            "total_objects": 2,
                            "objects_entered_delta": 1,
                            "objects_exited_delta": 0,
                            "objects_above_max_time_threshold_count": 1,
                            "current_objects_count": 2,
                            "current_objects": [
                                {
                                    "id": "15069984211300461000",
                                    "first_seen": 20,
                                    "time_present": 3600
                                },
                                {
                                    "id": "1506998428100461000",
                                    "first_seen": 22,
                                    "time_present": 20
                                }                          
                            ]
                        }
                    ]
                }
            ],
            "objects": [
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 236,
                        "height": 15,
                        "left": 339,
                        "width": 31
                    },
                    "id": 1506998428100461000,
                    "label": "car"
                },
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 250,
                        "height": 19,
                        "left": 235,
                        "width": 35
                    },
                    "id": 1506998428100461000,
                    "label": "car"
                },
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 447,
                        "height": 244,
                        "left": 0,
                        "width": 158
                    },
                    "id": 1506998428100460500,
                    "label": "car"
                },
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 495,
                        "height": 205,
                        "left": 427,
                        "width": 135
                    },
                    "id": 1506998428100460500,
                    "label": "car"
                },
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 518,
                        "height": 194,
                        "left": 239,
                        "width": 158
                    },
                    "id": 1506998428100460500,
                    "label": "car"
                },
                {
                    "attributes": [],
                    "probability": -0.10000000149011612,
                    "class_id": 0,
                    "rect": {
                        "top": 538,
                        "height": 173,
                        "left": 96,
                        "width": 154
                    },
                    "id": 1506998428100461000,
                    "label": "car"
                }
            ]
        }
    ]
}

Metadata

This node does not add any new metadata to the frame.

Metadata PropertyDescription
NoneNone