This is a simple AWS Lambda function which is supposed to be enabled by cron and periodically run in the AWS. It will scan an inbox on whether that contains a new mails and based on that sending an SNS message into the SNS topic and further on as an SMS.
-
Follow these steps and name a zip archive like this -
invoice-notification-function.zip -
Create an IAM role
aws iam create-role \
--role-name invoice-notification-lambda \
--assume-role-policy-document file://trust-policy.json- Grant full access to an SNS for that role
aws iam put-role-policy \
--role-name invoice-notification-lambda \
--policy-name LambdaSNSFullAccess \
--policy-document file://sns-full-access.json- Deploy Lambda function
aws lambda create-function --function-name invoice-notification-function \
--runtime python3.13 --handler lambda_function.lambda_handler \
--role arn:aws:iam::117863533677:role/invoice-notification-lambda \
--zip-file fileb://invoice-notification-function.zip- Add all the necessary environment variables
aws lambda update-function-configuration \
--function-name invoice-notification-function \
--environment "Variables={TOPIC_ARN=VALUE,IMAP_SERVER=VALUE,IMAP_PORT=VALUE,LEASE_EMAIL=VALUE,SALARY_EMAIL=VALUE,USERNAME=VALUE,PASSWORD=VALUE}"-
Add a trigger in the EventBridge. That could be done in the AWS Console UI within the Lambda configuration.
-
Create a new SNS topic:
aws sns create-topic --name invoice-notification- Create a subscription via the SMS, email, etc.