A lambda function that (a) sends fantasy football updates via GroupMe on a Cron job and (b) sends alerts when the trigger phrase (!update
or !injury report
) is sent in the group.
This is a Typescript lambda function that hits the ESPN fantasy football API to request updates before sending messages using the GroupMe API. Infrastructure lives in AWS and is defined/deployed using AWS CDK.
Use this link to create a GroupMe bot, and copy the bot ID.
This API connects to the ESPN Fantasy Football API. To find your league ID, click on your league online and the url should change to
https://fantasy.espn.com/football/league?leagueId=[your league ID here]
Create a .env file in the root directory and add those IDs:
GM_BOT_ID=abcd1234
FF_LEAGUE_ID=1234567
In the root fantasy-bot/
directory:
cd lambda
npm install // download lambda's dependencies
cd ..
npm install // download cdk's dependencies
npm run build
This will download npm modules for both the infrastructure and the lambda code itself, and compile the typescript to javascript.
The bin
directory contains the binary that creates the Cloudformation stack, and the lib
folder is where you'll build the stack itself.
Whether you change the lambda or the infrastructure, simply run npm run build
from the root directory.
Run cdk deploy
. This will deploy / redeploy your Stack to your AWS Account.
You'll need to download the CDK CLI if you don't have it already:
npm install -g aws-cdk
npm run build
compile typescript to jscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
prints the generated CloudFormation template