Subscriptions via Email

This section describes the subscription structure and implementation.

Basics

An important feature of OffenesParlament.at is the ability to subscribe to certain pages for email-updates, if and when they get changes through a scrape. This includes search views as well as detail views. To maintain a maximum of privacy for the user while also keeping the user’s data and email-adresses safe and spam-free, a verification process is used that provides one-time links for verifying the subscriptions as well as viewing a list of subscriptions for a given user. The following functionalities have been implemented:

  • Subscription of a page via web form
  • Verification email sending, Verification view
  • Subscription List view
  • Subscription List URL reminder email sending
  • Subscription Deletion

The following things are in beta or have yet to be implemented:

  • Frontend Design for views
  • Actual “Changes” email based on search results
  • Frontend/JS code to create proper subscription URLS pointing towards a JSON search result from ElasticSearch
  • Subscription Titles (need to be autogenerated based on search results)

Views and URL-Schemes

The following are the URLs for the new subscription service:

URL Description
/verify/<email>/<key> verify the given email adress for the subscription with the given hash-key
/subscribe subscribe an email adress to a given URL (email and url must be in POST-data)
/unsubscribe/<email>/<key> unsubscribe email-address from subscription with the given hash-key
/list/<email>/<key> list all subscriptions for the given email with the given verification key (for the user/email itself, not for any subscriptions)
/list/<email> re-send subscription list email, with the hash-key for the list view

Email Templates

The emails being sent are saved as *.email templates in offenesparlament/templates/subscription/emails; they follow the normal Django templating language. Variables can be defined and accessed via normal {{ var_name }} statements.

To facilitate the easy use of templates, an Email sending controller has been implemented in offenesparlament.constants.EmailController. It serves as a base class for the actual Email-Template-Classes (cf. for example offenesparlament.constants.EMAIL.VERIFY_SUBSCRIPTION). It provides an easy shortcut to Django’s Email-Sending Module, automatically rendering the assigned template files and sending the email to the requested recipient.