This twitterbot uses AWS Lambda and AWS Key Management Service. This twitterbot will tweet based on configured Cloudwatch Events
- Node.js 18+
- AWS Lambda execution role with KMS decrypt permission
- X (Twitter) app credentials
Set the Lambda environment variable:
FN_ENCRYPTED_CONFIG: Base64 encoded KMS-encrypted JSON payload containing:consumer_keyconsumer_secretaccess_token_keyaccess_token_secret
Example decrypted JSON:
{
"consumer_key": "xxx",
"consumer_secret": "xxx",
"access_token_key": "xxx",
"access_token_secret": "xxx"
}npm install- Lambda handler:
index.handler - Trigger from EventBridge/CloudWatch schedule to post periodically.
- The tweet text uses
Asia/Kolkatatimezone.