An example event-driven application which sends webhooks using Amazon EventBridge Pipes.
The application takes the change data capture event for DynamoDB streams and uses EventBridge Pipes and API destinations to send the event to an external endpoint.
- AWS SAM CLI
- Python 3.10
- Optional: evb-cli for generating EventBridge patterns
- Optional: eventbridge-transformer
- Deploy the application using AWS SAM and follow the instructions.
sam deploy --guided
- Once the application is deployed, you can test a webhook delivery by modifying the DynamoDB table. For example:
paymentId=$(date -u +"%Y%m%dT%H%M%S")
aws dynamodb put-item \
--table-name PaymentStatusEvents \
--item '{
"paymentId": {"S": "'$paymentId'"},
"status": {"S": "Paid"}
}'
- The webhook will subsequently be delivered to the endpoint specified. You can use tools such as webhook.site for prototyping such as in the code example: https://webhook.site/37e1931b-30c9-4d31-8336-8ec57b8be177
To avoid unnecessary costs, clean up after using the solution.
sam delete
-
For illustrative purposes only, we use
API_KEY
(instead ofOAUTH_CLIENT_CREDENTIALS
) as theAuthorizationType
for the API Destinations Connection. If you would like to use OAuth, you will need to specify an endpoint with OAuth. -
The webhook subscription management application is currently not included in this repository. However, if you're interested in exploring a solution, please feel free to raise a Github issue.
-
This repository is for illustrative purposes only. In production, ensure that you store any sensitive credentials securely, such as using AWS Secrets Manager.