Campaign groups sometimes encourage their supporters to email their MP with a pre-written letter prepared by the campaigners. Whilst this makes it easy for people to communicate their support for the issue in question, a form letter is less persuasive than a real letter.
With this tool, you can allow people to write to their MP about a particular issue, and give them appropriate guidance about what to write. This advice can be different for different MPs: you can divide the MPs into groups that you define, and present different advice depending on the group. For example, the appropriate advice may be different depending on the MPs past voting record on your particular issue.
The user is directed to the MySociety WriteToThem site to send the message, once they have composed it.
This code is distributed as an application that runs on Google App Engine. It can be incorporated into an existing App Engine site, or run separately. For example, if your main web site is at www.example.org you could run this application on a subdomain such as mp.example.org.
The rest of these instructions assume you want to install it as a separate application.
- You need a Google account. If you have a GMail address, that will do. If not, you can make a Google account by filling in this form.
- Download this application from https://github.com/robinhouston/write-to-mp/zipball/master and unzip it – or check out the git repository, if you know how to do that.
- Register for a TheyWorkForYou API key, and keep a note of it.
- If you're using Windows, install Python 2.7. (If you're using a Mac or Linux, it is probably installed already, so you can skip this step.)
- Download the Google App Engine SDK for Python and install it on your computer.
- Run the Google App Engine Launcher.
- Choose "Add existing application", and select the directory containing this application.
- Click the Run button.
- Go to http://localhost:8080/mp/write in your web browser, and make sure a page appears.
For advanced users: There is a test data set distributed with this code, in the file
data/test-data.sqlite
. You can tell the dev appserver to use this data file by passing
the command-line options --use_sqlite --datastore_path=data/test-data.sqlite
. This contains
the list of Westminster MPs as of 1 October 2012.
- Create a Google App Engine application here.
- Edit the file
app.yaml
and on the first line insert the application identifier you just chose, in place ofwrite-to-mp
. - Click the Deploy button in the Google App Engine Launcher.
- Go to the settings page at http://your-app-id.appspot.com/mp/admin/settings, and put in your TheyWorkForYouAPI key (obtained in Basic Setup above). This is also the page where you will edit the introductory text for your campaign. If you are targetting the Scottish Parliament, change the parliament setting from Westminster to Holyrood at this point.
- Check you can see the page you looked at on your computer by going to
http://your-app-id.appspot.com/mp/write, replacing
your-app-id
with the id of your application, which you chose in step 1. - Tell the application to download the list of MPs or MSPs from TheyWorkForYou by going to http://your-app-id.appspot.com/mp/cron/update_mps You will have to log in using your Google account at this point. If this step works correctly, you will see the message "Fetching new MPs in the background".
- You can monitor the progress of the download by loading http://your-app-id.appspot.com/mp/admin/list and reloading it periodically to check that the list is updating.
- Register your domain for Google Apps, if you haven't already.
- Follow these instructions.
This is the advice that users see next to the letter-writing form, after entering their name, email address and postcode.
At its most basic, you can just go to http://your-app-id.appspot.com/mp/admin and put in some text. If you want your advice to be shown as collapsible sections that can be expanded by clicking, you have to format it in a specific way, like this:
1. First collapsible section
* bullet point, which can have a whole paragraph of text.
* another bullet point
2. Second collapsible section
* bullet point here
* etc.
Note that the placement of blank lines and the precise number of spaces before a star is crucial. You may have to use some trial-and-error to get it right!
You should also edit the introductory text to explain your campaign, on the settings page at http://your-app-id.appspot.com/mp/admin/settings.
You can also create groups of MPs, by clicking the "New group" button and entering appropriate text. You can add MPs to the group by typing their names, or by using the list interface and choosing the appropriate group from the dropdown menu.
Before running a campaign you should read https://www.writetothem.com/about-guidelines and contact WriteToThem to check they are happy with it, since it relies on their service for sending the messages.
The appearance of the pages can be customised by editing the master template mp/template.html
and the style sheet styles/common.css
. The templates use the Jinja2
template language.
Developed for the 10:10 Lighter Later campaign.
Written by Robin Houston [email protected]
This code is copyright 10:10, 2010, and is made available under the terms of the GNU GPL v2.