Build a Crypto Price Alert System with TypeScript, AWS Lambda, and Telegram
In this video, we will create a simple system that sends a Telegram message when a cryptocurrency’s price goes above or below a specified threshold, all written in TypeScript. By running this as an AWS Lambda function, we keep costs low and reduce complexity. We start by forking RadzionKit as a base for this project, and then build our functionality on top of it. If you trade crypto occasionally or just want to be alerted when a certain price is reached, this system can give you peace of mind. You won’t need to constantly monitor the prices, saving time and reducing stress. We define a price alert with fields like an id, asset ID, targetPrice, condition (above or below), and a flag to indicate if the user has been notified. Since it’s just for our use, we don’t need multiple user support, but you could add that by assigning different Telegram chat IDs. To set and update alerts, we run a script that clears existing alerts and inserts new ones, for example, one alert if Ethereum’s price goes above a certain value, and another if it goes below a threshold. CRUD operations on the alerts are done through functions backed by the RadzionKit utilities and DynamoDB. We fetch crypto prices using the CoinGecko API and then send Telegram messages via a bot whenever conditions are met. We consolidate all logic into one main function that retrieves alerts, checks conditions, sends notifications if needed, and updates alerts accordingly. We deploy this solution as an AWS Lambda function and wrap it with Sentry for error monitoring. Using Terraform, we set up required resources and schedule the function to run every 10 minutes with a CloudWatch Event Rule. All the code is available on GitHub, and the blog post contains code snippets and explanations. GitHub: https://github.com/radzionc/crypto Blog post with code snippets: https://radzion.com/blog/crypto-alert
Download
0 formatsNo download links available.