Path: blob/master/webhooks/webhook_lambda/README.md
1072 views
Webhook via AWS Lambda example
This guide aims to provide you with a minimum sample to receive webhook data from Snapshot/Stream on your AWS Lambda instance.
Create Lambda function
Open Lambda on your AWS dashboard.
Click "Create function".

Fill the function name with "test_webhook". Select Python 3.10 for the Runtime, then click "Create function".

Inside the code editor, replace the content with the code from lambda_function.py. This code sample will receive webhook data and log them into CloudWatch.
Click Deploy

Create API gateway
Open API Gateway dashboard in AWS.
Click "Create API"

Click the "Build" button for HTTP API.

Click "Add integration", then select Lambda.
In the "Lambda function" text box, search for the function you created earlier.
Fill "API name" with "test_api". Then click the "Next" button.

Select "POST" as the Method. Click "Next".

We are going to skip creating Stages, so click "Next" again and then click "Create".

On the left side menu, click the link "API: test_api".

Copy the "Invoke URL". Put this url into your Snapshot/Stream webhook configuration and append it with
/test_webhook.
CloudWatch logs
Open "CloudWatch" in AWS.
Open Logs > Log groups.
Click the log group for "test_webhook".

When your webhook receive new data, it will log the basic information about the vehicle here.