FoveaCentral / vaccinesignup

A Twitter bot that notifies users about available vaccine appointments
https://twitter.com/vaccinesignup
Creative Commons Zero v1.0 Universal
2 stars 0 forks source link
covid-19 ruby twitter-bot vaccine-appointments

@vaccinesignup

test Maintainability Coverage Status OpenSSF Best Practices OpenSSF Scorecard

This Twitter bot notifies users who DM their zip codes to @vaccinesignup about available vaccine-appointment Locations in their area. Our current data source only supports LA County.

Usage

Users

  1. Follow @vaccinesignup.

  2. DM @vaccinesignup a zip code only:

    zip

  3. The bot will DM you available Locations in that zip:

    appointments

  4. To stop all notifications, DM stop to @vaccinesignup.

Developers

Installation

  1. Set your Twitter API keys as environment variables:

    export POSTGRES_USER=[postgres user]
    export POSTGRES_PASSWORD=[postgres password]
    export TWITTER_CONSUMER_KEY=[your key]
    export TWITTER_CONSUMER_SECRET=[your secret]
    export TWITTER_ACCESS_TOKEN=[your access token]
    export TWITTER_ACCESS_SECRET=[your access secret]
  2. Install dependencies with Bundler:

    bundle install

Available Tasks

$ rake -T|grep vacc
rake vaccinesignup:back_up              # Back-up production data and restore to the local environment
rake vaccinesignup:delete_real_users    # Delete real (non-test) users from development environment
rake vaccinesignup:read_and_notify      # Read DMs and, if there are subscribed zip codes, notify users
rake vaccinesignup:reset_staging        # Back-up production, restore locally, and delete real users for testing
rake vaccinesignup:sync_and_notify      # Sync Locations and, if there are changes, notify users

When configuring tasks for production, the timing on both should be optimized depending on how often Locations are updated and DMs are tweeted, respectively.

Mirror Production Locally

  1. Configure environment variables:
    export TWITTER_CONSUMER_KEY=[your key]
    export TWITTER_CONSUMER_SECRET=[your secret]
    export TWITTER_ACCESS_TOKEN=[your token]
    export TWITTER_ACCESS_SECRET=[your access secret]
  2. Reset local database to a known state:
    bundle ex rake db:reset
  3. Back-up production data and restore to the local environment:
    bundle ex rake vaccinesignup:back_up

Release Testing

  1. Reset local/staging environment:
    bundle ex rake vaccinesignup:reset_staging
  2. Test location syncing/notification:
    bundle ex rake vaccinesignup:sync_and_notify
  3. Test reading DMs/notification:
    bundle ex rake vaccinesignup:read_and_notify

Contributing to @vaccinesignup

Copyright

Copyright © 2021-2024 Roderick Monje. See LICENSE for further details.