Quick Start: Deploy a complete webhook receiver to AWS in under 10 minutes with our battle-tested TypeScript recipe. Perfect for production workloads and new webhook implementations.
Overview
The Webhook Receiver Recipe is a production-ready, AWS-based webhook receiver template that helps developers quickly implement robust webhook handling for Smartcar integrations. This TypeScript recipe provides a deployable starting point that makes adding custom business logic easy, eliminating much of the complexity of building webhook infrastructure from scratch.- Repository: smartcar/typescript-webhook-recipe
- Deployment Target: AWS (Lambda + API Gateway + SQS)
- Language: TypeScript/Node.js v22+
- Infrastructure: AWS CDK (Infrastructure as Code)
What You Get
Complete Serverless Architecture
- API Gateway: Public HTTPS endpoint for webhook delivery
- Lambda Functions: Serverless processing with automatic scaling
- SQS Queues: Asynchronous message processing with built-in retry logic
- Dead Letter Queues: Error handling and failed message recovery
- CloudWatch: Comprehensive logging and monitoring
Production-Ready Features
- Webhook Verification: Automatic payload signature validation
- Error Handling: Graceful failure handling with retries
- Scalability: Automatic scaling to handle traffic spikes
- Security: IAM roles with least-privilege access
- Monitoring: Built-in CloudWatch logging
- Type Safety: Full TypeScript support with Smartcar types
Infrastructure as Code
- Complete AWS CDK setup for repeatable deployments
- Environment-specific configurations (dev, staging, production)
- Easy customization and extension
When to Use This Recipe
Perfect for:- New webhook receiver implementations
- Teams using AWS as your cloud provider
- Production workloads requiring reliability and scale
- Teams wanting to deploy quickly without infrastructure complexity
- TypeScript/Node.js projects
Architecture Overview
The recipe provides a complete serverless webhook receiver infrastructure on AWS. The diagram below shows the data flow from Smartcar webhooks through your deployment:Orange components are provided by the recipe and deployed automatically. Gray components represent external systems where your custom business logic would live.
Key Components
- Receiver Lambda: Validates incoming webhooks and queues them for processing
- SQS Queue: Decouples receiving from processing for reliability
- Processor Lambda: Processes webhook payloads and executes business logic
- Dead Letter Queue: Captures failed messages for investigation
- CloudWatch: Monitoring, logging, and alerting
Quick Start
Prerequisites
- AWS Account with CLI configured
- Node.js v22+ installed
- Git
- Smartcar Application configured in the Dashboard
- You’ll need your Application Management Token (found in Dashboard → Configuration)
- Learn how to configure your application
Deployment Steps
1
Clone the Repository
2
Build the Project
3
Deploy to AWS
The recipe uses AWS CDK for infrastructure deployment. First, create a secret to store your Application Management Token, then deploy the stack.For detailed deployment instructions including environment-specific configuration, see the GitHub repository README.
Use the same
appName value for both commands. This name will be used to identify your CloudFormation stack and associated resources.4
Configure Webhook in Dashboard
Now that your receiver is deployed, configure the webhook integration in Smartcar Dashboard:For detailed webhook configuration guidance, see Webhooks Setup.
- Go to your Smartcar Dashboard
- Click + Add Integration and select Webhooks
- Configure your webhook:
- Webhook URL: Use the deployed URL from the previous step
- Trigger: Choose when to send webhooks (e.g., “State of charge changes”)
- Signals: Select the vehicle data you want to receive (e.g., battery level, location, odometer)
- Click Save - Smartcar will automatically verify your endpoint
The recipe automatically handles webhook verification. If verification fails, check CloudWatch logs for errors.
5
Subscribe Vehicles (Optional)
Depending on your webhook configuration, you may need to manually subscribe vehicles:
- Auto-subscribe enabled: New vehicle connections will automatically start sending webhook data
- Manual subscription: Use the Subscribe endpoint or Dashboard to subscribe specific vehicles
The deployment typically takes 2-3 minutes. The recipe will output your webhook URL and other important configuration details upon completion.
Customizing Your Webhook Processor
The recipe includes a sample processor that logs webhook data. To implement your business logic:Configuration Options
The recipe uses AWS CDK for infrastructure configuration. You can customize various aspects by modifying the CDK stack configuration inlib/webhook-receiver-stack.ts.
Common Configuration Options
Use these CDK properties (not environment variables) to tune the stack. Their camelCase names match the props inlib/webhook-receiver-stack.ts.
| Configuration | Description | Example |
|---|---|---|
logLevel | Logging verbosity for Lambda functions | See example |
memorySize | Lambda function memory allocation in MB | See example |
visibilityTimeout | SQS message visibility timeout | See example |
maxReceiveCount | Max retries before dead letter queue | See example |
Monitoring and Troubleshooting
CloudWatch Logging
The recipe includes built-in CloudWatch logging for debugging and monitoring. You can:- View Lambda execution logs
- Track webhook deliveries and failures
- Monitor SQS queue metrics
CloudWatch alarms are not included by default. You can add custom alarms on top of CloudWatch metrics based on your monitoring needs.
Common Issues
Webhook verification failing
Webhook verification failing
- Check that your Smartcar Application Management Token is correct
- Verify the webhook URL matches your deployed endpoint
- Check CloudWatch logs for verification errors
Messages stuck in dead letter queue
Messages stuck in dead letter queue
- Review CloudWatch logs for processing errors
- Check if external services (databases, APIs) are accessible
- Verify IAM permissions for Lambda functions
High latency or timeouts
High latency or timeouts
- Consider increasing Lambda memory allocation in CDK configuration
- Optimize external API calls and database queries
- Check for cold start issues in Lambda functions
Debugging Commands
Next Steps
After deploying your webhook receiver:- Test Your Integration: Use the Smartcar Dashboard to test webhook delivery
- Monitor Performance: Set up CloudWatch alarms for error rates and queue depths
- Scale as Needed: Adjust Lambda memory and SQS settings based on usage patterns
- Add Features: Extend the processor logic for your specific use cases
Support and Contributing
- Issues: Report bugs or request features in the GitHub repository
- Discussions: Ask questions in GitHub Discussions
- Documentation: Full setup and customization details in the repository README

