This project implements an AWS Lambda function that processes RevenueCat webhook events and sends notifications to a Telegram channel. It also provides a daily summary of events at midnight Jakarta time.
- Real-time notifications for RevenueCat events (purchases, renewals, cancellations, etc.)
- Daily summary of events sent at midnight Jakarta time
- In-memory data storage for efficient processing
- Easy setup using AWS Lambda and EventBridge
- An AWS account with access to Lambda and EventBridge
- A Telegram bot token and channel ID
- A RevenueCat account with webhook configuration
- Go to AWS Lambda console and create a new function.
- Choose Python 3.8 or later as the runtime.
- Copy the code from
lambda_function.py
in this repository to your Lambda function.
In the Lambda function configuration, add the following environment variables:
TELEGRAM_BOT_TOKEN
: Your Telegram bot tokenTELEGRAM_CHANNEL_ID
: Your Telegram channel ID
- Go to Amazon EventBridge console and create a new rule.
- Set the rule to run on a schedule.
- Use the following cron expression to run at midnight Jakarta time (5pm UTC):
0 17 * * ? *
- Set the target as your Lambda function.
In your RevenueCat dashboard:
- Go to Project Settings > Integrations.
- Add a new webhook.
- Set the URL to your Lambda function's invoke URL.
- Select the events you want to receive notifications for.
Once set up, the system will automatically:
- Send individual notifications to your Telegram channel for each RevenueCat event.
- Send a daily summary at midnight Jakarta time.
To reset the in-memory data, invoke the Lambda function with the following test event:
{
"action": "reset_data"
}
You can modify the lambda_function.py
file to customize:
- The format of individual event messages
- The content of the daily summary
- The timezone for the daily summary (currently set to Asia/Jakarta)
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.