Webhook Middleware Integrations
Getting Started
To integrate the middleware, you'll first need to configure the environment variables and run the middleware. This section guides you through creating the necessary .env
file, running the middleware, and configuring Stream to send webhook data to your middleware.
Step 1: Create the .env
File
Each middleware requires specific environment variables for its configuration. Below is a general guide on creating the .env
file for different middleware options. Make sure to modify the variables according to the middleware you're using.
Sample .env
File for Synology REST Protocol Middleware
MIDDLEWARE_NAME=synology_rest
REST_SERVICE_URL=https://example.com/rest-service
Refer to the respective middleware section for other middleware-specific configurations.
Step 2: Run the Middleware
After setting up the .env
file, you can run the middleware. This will ensure the middleware is listening for webhook data from the Stream.
Common Run Command
For all middleware, use the following command to run the middleware Docker container:
docker run -it --env-file .env -p 8002:8002 platerecognizer/stream-gateway
This command will run the middleware on port 8002
, exposing it to receive webhook data. The list.csv
file is imported automatically during initialization from Parkpow, so there's no need to create a volume for it.
Note: If you prefer to mount the
list.csv
file manually, use./list.csv
for compatibility across Windows systems:
docker run -it --env-file .env -p 8002:8002 -v ./list.csv:/app/list.csv platerecognizer/stream-gateway
Step 3: Install Plate Recognizer Stream
Plate Recognizer Stream processes video streams and generates webhook data based on license plate recognition events.
Installation
Follow the installation instructions for your operating system:
- Linux, MacOS, Windows, and Docker: Stream Installation Guide
Step 4: Configure Stream to Send Webhook Data
Once the middleware is up and running, configure Plate Recognizer Stream to send webhook data to the middleware.
Webhook Configuration
Edit the Stream configuration file (typically named config.ini
) to include the following webhook settings:
[webhooks]
caching = yes
[[middleware]]
url = http://YOUR_IP_ADDRESS:8002
image = vehicle, plate
request_timeout = 30
For more details on webhook configuration, refer to the Webhook Configuration Guide.
Middleware Integrations
This guide covers how to configure and run various middleware protocols for handling webhook data.
Available Middleware
Middleware | Description |
---|---|
Synology REST Protocol Middleware | Forwards webhook data to a REST service. |
Crop Plate and Forward Middleware | Crops an image and forwards data to a webhook. |
Salient VMS Middleware | Forwards events to CompleteView/Salient VMS. |
OpenEye Middleware | Forwards parsed JSON data to OpenEye monitoring API. |
NX Middleware | Manages sessions and creates bookmarks in NX server. |
SOAP Protocol Middleware | Forwards webhook data to a SOAP service. |
Synology REST Protocol Middleware
Description: Forwards webhook data to a REST service.
Required Environment Variables
MIDDLEWARE_NAME=synology_rest
REST_SERVICE_URL
: The URL of the REST service.
Crop Plate and Forward Middleware
Description: Crops an image from webhook data and forwards both the original and cropped images to another webhook endpoint.
Required Environment Variables
MIDDLEWARE_NAME=crop_plate
WEBHOOK_URL
: The URL of the webhook endpoint where data is forwarded.
Salient VMS Middleware
Description: Forwards Stream webhook events to a CompleteView/Salient VMS as events.
Required Environment Variables
MIDDLEWARE_NAME=salient
VMS_USERNAME
: Username for Salient VMS.VMS_PASSWORD
: Password for Salient VMS.VMS_API_URL
: API endpoint for Salient VMS.CAMERA_UID
: UID of the camera used as the source of events.
OpenEye Middleware
Description: Forwards parsed JSON data to the OpenEye monitoring API.
Required Environment Variables
MIDDLEWARE_NAME=openeye
AKI_TOKEN
: AKI token for authentication.AKS_TOKEN
: AKS token for authentication.
NX Middleware
Description: Manages a session with an NX server, retrieves tags from the Parkpow API, and creates bookmarks in the server using the REST API.
Required Environment Variables
MIDDLEWARE_NAME=nx
SERVER_HOST
: Host URL of the NX server.LOGIN
: Username for server login.PASSWORD
: Password for server login.SSL
: Boolean value for enabling SSL verification (True
orFalse
).PARKPOW_TOKEN
: Token for accessing the Parkpow API.TAG
: Tag used for filtering in the Parkpow API. (e.g. TAG=Block,Authorized)
SOAP Protocol Middleware
Description: Forwards webhook data to a SOAP service.
Required Environment Variables
MIDDLEWARE_NAME=soap
SOAP_SERVICE_URL
: The URL of the SOAP service.SOAP_USER
: Username for SOAP service authentication.SOAP_SERVICE_KEY
: Key for SOAP service authentication.
If you wish to modify or extend the middleware functionalities, you can access the source code on GitHub:
GitHub Repository for Middleware