Big Cases Bot 2 uses CourtListener's REST API to receive news about new filings. It does this via webhooks. When CourtListener learns about a new docket entry in a followed case, CourtListener will POST a webhook to BCB2 with information about the docket entry and documents associated with it.
BCB2 uses a Postgres database to keep track of cases and documents it knows about.
BCB2 posts to Twitter (@big_cases), Mastodon (@[email protected]), and Bluesky (@bigcases.bots.law).
- For now, you can't @-mention the bots, but it's being tracked in issue #28.
To set up a development machine, do the following:
-
Clone the bigcases2 repository.
-
Create a personal settings file. To do that, copy-paste the
.env.example
file to.env.dev
. -
Modify your new
.env.dev
file and uncomment the lineALLOWED_HOSTS="*"
-
Next, create the bridge network that docker relies on:
docker network create -d bridge --attachable bc2_net_overlay
This is important so that each service in the compose file can have a hostname.
-
cd
into bigcases2/docker/bigcasesbot, then launch the server by running:docker compose up -d --build
-
Once that's done, it'll be up at http://localhost:8888 (note the port; it's different than normal)
-
Generate some dummy data for your database:
docker exec -it bc2-django python manage.py bootstrap-dev
-
Lookup specific data from CourtListener:
docker exec -it bc2-django python manage.py lookup 64983976
This will use CL API to lookup the Docket
64983976
and output its data in the console. This command also accepts the following command line options:--add
: saves the case in the database--subscribe
: creates a CourtListener docket alert subscription
-
Post something manually in the registered channels:
docker exec -it bc2-django python manage.py post
-
Create mastodon subscription to push notifications:
docker exec -it bc2-django python manage.py mastodon-subscribe
This command requires that the following variables are set in the .env file:
MASTODON_SHARED_KEY
,MASTODON_PUBLIC_KEY
,MASTODON_PRIVATE_KEY
andHOSTNAME
. We added a script to generate the first three variables. Execute the following command to use the script and paste the result in your .env file:docker exec -it bc2-django python /opt/bigcases2/scripts/get-mastodon-keys.py
Make sure that the
MASTODON_TOKEN
andMASTODON_SERVER
are set before using the previous command. -
Delete mastodon subscription to push notifications:
docker exec -it bc2-django python manage.py mastodon-unsubscribe
- Receives webhooks from CourtListener, Twitter, and Mastodon
- Processes new documents from CourtListener (generate thumbnails, create posts, post)
/webhooks/docket-[secret]
: From CourtListener, delivered when there is a new document in a followed case. The full URL is secret./webhooks/twitter
: From Twitter, Account Activity API/webhooks/mastodon
: From Mastodon instance, Web Push API
BCB2 generates images of the first few pages of a document by using Doctor.
- Django
- Mastodon.py
- Doctor
- rq (soon, see #35)
- Nginx: web proxy/server
- Docker (for Doctor)