Sends email alerts to the public for GOV.UK
Ruby
Switch branches/tags
Clone or download
koetsier Merge pull request #640 from alphagov/remove-in-batches-from-email-de…
…letion-worker

Remove in_batches from the EmailDeletionWorker
Latest commit a11783d Jul 19, 2018

README.md

email-alert-api

Sends emails to users that subscribe to specific GOV.UK email alerts.

Provides a consistent internal interface to external email notification services. Currently supports only GOV.UK Notify.

Given a tagged publication event, it sends email alerts for subscribers to those tags via the external services.

Nomenclature

  • Content change:

    • A publication event that creates or changes a content item
    • The representation of that event for the purpose of sending emails
  • Delivery attempt:

    • An attempt to send a generated email to a subscriber using the external email notification services
    • Can be multiple attempts per email if there are errors
  • Digest run:

    • One batch of either daily or weekly digests representing a particular subscription that has a start and end time and a set of subscribers to send emails to
  • Email:

    • An email generated from one or more content changes with a subject line and body, to be sent to subscribers
  • Matched content change:

    • A content change that has been matched to a set of subscribers who will receive an email about it
  • Subscriber list:

    • A set of criteria that users can subscribe to in order to receive emails (eg. all publications by HMRC)
  • Subscriber:

    • A user who has subscribed to one or more subscriber lists
  • Subscription:

    • The relationship between a subscriber and the subscription lists they are subscribed to

Technical documentation

Dependencies

  • PostgreSQL database (9.3 or higher - requires json with json_object_keys method)
  • Redis (for Sidekiq)
  • GOV.UK Notify API key and other details (see email_service.yml for required fields)

Initial setup

  • Check that the configuration in config/database.yml is correct
  • Run bundle exec rake db:setup to load the database

Running the application

$ ./startup.sh
  • email-alert-api runs on port 3088
  • sidekiq-monitoring for email-alert-api uses 3089

Running the test suite

  • Run RAILS_ENV=test bundle exec rake db:setup to load the database
  • Run bundle exec rspec to run the tests

Using test email addresses for signup

Using any email address that ends with @notifications.service.gov.uk will not create a subscriber or a subscription, however will return a 201 Created response.

Documentation

Licence

MIT License