This is an example to create an AWS Lambda application with Babel-based ES2015. This application simply tweet the current weather.
Using livedoor Weather Hacks.
git clone https://github.com/hkusu/lambda-twitter-bot
cd lambda-twitter-bot
npm install
Get the keys of your twitter application in https://apps.twitter.com.
Permission, please choose
Read and Write
.
Set the keys to the .env
file.
CONSUMER_KEY = your consumer key
CONSUMER_SECRET = your consumer secret
ACCESS_TOKEN = your access token
ACCESS_TOKEN_SECRET = your access token secret
CITY = 130010
CITY
code, find from primary_area.xml.
npm run lint
npm run watch
npm run local-run
npm run build
Upload the created app.zip in the console of the AWS Lambda.
Role, does not require special permissions.
Triggers, select the CloudWatch Events(Schedule)
. Or, if you can add a parameter to the event(ex: POST method of API Gateway), it is possible to pass the city as follows:
{
"city": "011000"
}