Testing the Hook
Before testing the hook, make sure that the test server we have set up in this section is running and that you have a console window open where you can watch its standard output.
The easiest way to test whether the newly registered hook works correctly is to send a Vehicle API request from the Cloud Dashboard Demo Page.
Find a Test Imageโ
Find an image of a vehicle with the license plate visible, or download this one for a quick test:

Determine the region and countryโ
Choose the region and expected location of the vehicle. For the image above, the region is eur (Europe) and the location is ROU (Romania).
Valid values for the region are:
- Europe:
eur - Africa:
afr - Australia:
aus - North America:
nam - Central America:
cam - South America:
sam - East Asia:
eas - Central Asia:
cas - South Asia:
sas - Middle East:
arab - Middle East:
me
For a list of all possible locations, please refer to this table.
Send the Requestโ
Fill in the demo form (the screenshot here shows values appropriate for the test image above):

Click the "Get Your Results" button.
Check the Server Logsโ
If the hook has been configured properly, a message similar to the following should appear in the test server logs:
INFO:root:============================
INFO:root:POST request,
Path: /
Headers:
X-Forwarded-For: 54.239.6.6
Host: <your-host>
X-Forwarded-Proto: http
Connection: close
Content-Length: 8328
x-amz-sns-message-type: Notification
x-amz-sns-message-id: <xxxxx>
x-amz-sns-topic-arn: arn:aws:sns:eu-central-1:328016752712:<your-topic-name>
x-amz-sns-subscription-arn: arn:aws:sns:eu-central-1:328016752712:<your-topic-name>:<your-subscription-id>
X-Amzn-Trace-Id: <xxxxx>
Content-Type: text/plain; charset=UTF-8
User-Agent: Amazon Simple Notification Service Agent
Accept-Encoding: gzip,deflate
Body:
{
"Type" : "Notification",
"MessageId" : "<xxxxx>",
"TopicArn" : "arn:aws:sns:eu-central-1:328016752712:<your-topic-name>",
"Message" : "{\n \"attachmentURLs\": [\n \"https://arhnordic-dev.s3.eu-central-1.amazonaws.com/private/eu-central-1%3Afcc47dc9-e3a3-4256-8b8b-c86fd5d353b9/87399ac3-8c02-470c-ae3a-84caa72e68ed.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20221020T134541Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86399&X-Amz-Credential=AKIAUYX2SOBELNIP5TEM%2F20221020%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Signature=8db5dc60be062652f59129a38eba58b0410316dda86b71cfdc6a855f17144450\"\n ],\n \"requestId\": \"87399ac3-8c02-470c-ae3a-84caa72e68ed\",\n \"principalId\": \"eu-central-1:fcc47dc9-e3a3-4256-8b8b-c86fd5d353b9\",\n \"api\": \"vehicle\",\n \"event\": {\"attachmentURLs\":[\"https://arhnordic-dev.s3.eu-central-1.amazonaws.com/private/...\"],\"requestId\":\"87399ac3-8c02-470c-ae3a-84caa72e68ed\",\"principalId\":\"eu-central-1:fcc47dc9-e3a3-4256-8b8b-c86fd5d353b9\",\"api\":\"vehicle\",\"event\":{\"data\":{\"vehicles\":[{\"plate\":{\"found\":true,\"country\":\"ROU\",\"plateTypeConfidence\":47,\"positionConfidence\":100,\"plateChars\":[],\"unicodeText\":\"B365BMW\",\"separatedText\":\"B 365 BMW\",\"engine\":\"cmanpr-7.3.12.116 : rou_local\",\"proctime\":73,\"confidence\":33,\"plateROI\":{},\"plateType\":110026},\"mmr\":{\"engine\":\"mmr-7.3.4.24 : mmr-eur\",\"found\":true,\"proctime\":87,\"category\":\"CAR\",\"categoryConfidence\":62,\"color\":{\"r\":0,\"g\":0,\"b\":255},\"colorConfidence\":95,\"make\":\"BMW\",\"model\":\"5\",\"makeConfidence\":100,\"modelConfidence\":62,\"heading\":\"frontal\",\"headingConfidence\":99},\"bounds\":{}}]},\"nodename\":\"74f2fb5c-8be8-4a2b-bcfb-e0708eacfd04 ([380]e1a68a7ba39f4ed4b128b1fc5b17aecb)\",\"nodetime\":250,\"version\":\"1.3\"},\"eventDataRoot\":\"event.data.vehicles\"},\n \"eventDataRoot\": \"event.data.vehicles\"\n}",
"Timestamp" : "2022-10-20T13:45:41.412Z",
"SignatureVersion" : "1",
"Signature" : "<signature>",
"SigningCertURL" : "https://sns.eu-central-1.amazonaws.com/SimpleNotificationService-56e67fcb41f6fec09b0196692625d385.pem",
"UnsubscribeURL" : "<unsubscribe-url>"
}
127.0.0.1 - - [20/Oct/2022 13:45:41] "POST / HTTP/1.0" 200 -
In production applications, we recommend performing the following security checks when receiving a webhook request:
- The topic name (the last colon-separated part of the
TopicArnin the subscription request body) must match thetopicNameproperty returned by the API after registering the hook. - The digital signature included in the
Signatureproperty must be valid.- Signature verification is documented in detail here by AWS.
- The most secure way to implement verification is to use the official client library for your programming language provided by AWS.
The purpose of this tutorial is to show the simplest possible way to implement a Hook, so we will skip the verification steps detailed above.
The Message property contains the forwarded event with some metadata:
{
"attachmentURLs": [
"https://arhnordic-dev.s3.eu-central-1.amazonaws.com/private/..."
],
"requestId": "87399ac3-8c02-470c-ae3a-84caa72e68ed",
"principalId": "eu-central-1:fcc47dc9-e3a3-4256-8b8b-c86fd5d353b9",
"api": "vehicle",
"event": {
"data": {
"vehicles": [
{
"plate": {
"found": true,
"country": "ROU",
"plateTypeConfidence": 47,
"positionConfidence": 100,
"plateChars": [ ... ],
"unicodeText": "B365BMW",
"separatedText": "B 365 BMW",
"engine": "cmanpr-7.3.12.116 : rou_local",
"proctime": 73,
"confidence": 33,
"plateROI": { ... },
"plateType": 110026
},
"mmr": {
"engine": "mmr-7.3.4.24 : mmr-eur",
"found": true,
"proctime": 87,
"category": "CAR",
"categoryConfidence": 62,
"color": {
"r": 0,
"g": 0,
"b": 255
},
"colorConfidence": 95,
"make": "BMW",
"model": "5",
"makeConfidence": 100,
"modelConfidence": 62,
"heading": "frontal",
"headingConfidence": 99
},
"bounds": { ... }
}
]
},
"nodename": "74f2fb5c-8be8-4a2b-bcfb-e0708eacfd04 ([380]e1a68a7ba39f4ed4b128b1fc5b17aecb)",
"nodetime": 250,
"version": "1.3"
},
"eventDataRoot": "event.data.vehicles"
}
The original API response is in the event property. The attachmentURLs array contains a link to the original input image.