This is the new version of the original Bible Bot that I wrote in order to Tweet a Bible reading plan. The new version is much expanded. At present it supports Instagram, but Twitter support is incoming.
Please feel free to modify this code to suit your own purposes.
This code assumes it will be ran on an AWS Lambda instance, using DynamoDB tables called readings and abbreviations. To get an up-and-running instance, you must do the following:
- Create the above-named DynamoDB tables.
- Populate your
readingstable with data in the following format:- Keys:
monthandday(numeric). - An entry is as follows:
{data: [{ref: 'Genesis 1:1'}, ...]}.refis fairly forgiving.
- Keys:
- Populate the
abbreviationstable as necessary. Use the following format:- Keys:
book_short(string) - An entry is as follows:
{book_short: 'gen', book: 'Genesis'}. Please notebook_shortshould always be lowercase.
- Keys:
- Correctly configure the AWS CLI.
- (optional) To pre-populate images (for Instagram posting), run
./scripts/fetch_image_urls_for_month.py. This fetches images for each ref in the given month from Faithlife. - (Instagram) Create an empty JSON file named
[your-instagram-username].jsonand upload it to a private bucket on Amazon S3. - Get a Redis URL from somewhere.
- Create a file
lambdas/biblein1year_main/config.jsonin the following format:
{
"redis_url": "[Redis URL from step 7]",
"instagram": {
"username": "[Instagram username]",
"password": "[Instagram password]",
"private_bucket_name": "[S3 bucket name from step 6]"
}
}(Don't worry about storing the Instagram password in plain-text - after you have run the script for the first time, a cookie will be created and you can safely replace this with null.
- Cd into
lambdas/biblein1year_main/config.json, runnpm install, then runwebpack. This should create a file./dist/lambda.zip - Create your Lambda. When asked for the code, upload the zip file from step 9, and set the handler path to
handler.handler. - Give the Lambda the following permissions:
- The default Lambda permissions (log writing etc.)
- DynamoDB: Permission to read both tables.
- S3:
getObjectandputObjecton the JSON file from step 6.
- (optional) Test the Lambda using the
testMode: trueoption (or the--testflag if running from command line) - (optional) To check for any upcoming concerns over the next 30 days, run
./scripts/find_problems.py