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
readings
table with data in the following format:- Keys:
month
andday
(numeric). - An entry is as follows:
{data: [{ref: 'Genesis 1:1'}, ...]}
.ref
is fairly forgiving.
- Keys:
- Populate the
abbreviations
table as necessary. Use the following format:- Keys:
book_short
(string) - An entry is as follows:
{book_short: 'gen', book: 'Genesis'}
. Please notebook_short
should 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].json
and upload it to a private bucket on Amazon S3. - Get a Redis URL from somewhere.
- Create a file
lambdas/biblein1year_main/config.json
in 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:
getObject
andputObject
on the JSON file from step 6.
- (optional) Test the Lambda using the
testMode: true
option (or the--test
flag if running from command line) - (optional) To check for any upcoming concerns over the next 30 days, run
./scripts/find_problems.py