Making the Democracy Bot for @TwitterAU

One of the best things about our close relationship with Twitter is the awesome civic projects that we get to work on. For the Australian election, the head of Public Policy in ANZ, Kara Hinesley approached us and asked if we could make a simple, easy to use experience to sit behind the @TwitterAU handle.

Introducing the Democracy Bot — Twitter’s got a great write up here and you can play with the experience by clicking here (if you’re on mobile and have the twitter app or are logged into twitter in your browser).

Our Goals

The goals of the project were simple:

  • Provide a simple, easy to use way for people to find their electorate information and candidates for the House of Reps election;
  • Help users find polling places (and highlight accessible polling places);
  • Engage in the fun of the day by helping people get in contact with @DemSausage to find a sausage sizzle on the day;
  • Help share information on how people can make their vote count;
  • Share information about how voters can check the sources of their information.

We got to work.


Twitter’s serious about privacy and we are too, so one of the core elements of this experience was not collecting any more user data than we needed. We don’t ask for addresses or specific locations because we care about user privacy — but we did wonder, given how big postcode areas can be in Australia, could we deliver a decent experience with just a postcode? You be the judge! We also aren’t storing the postcode, the postcode data is used to make the API query, we then cache the result for the user while they’re in that section of the experience and throw it away afterwards.

The Data

Australia standardsises their geographic areas with localities and postcodes and (with some exceptions) that’s open data. For the 2016 US election we built a similar informative experience using zip codes and Google’s Civic API all sitting behind the @gov handle. We weren’t as lucky with data here and had to cobble data together from a few sources to power the experience. Thankfully, the AEC makes available polling location data for the entire country (including accessibility information and proper geocoding!) as well as all candidates (well, you’d hope so).

Geo data was a bit more difficult.

The Postcode to Electorate data came from the wonderful Ben Raue, an extremely gun psephologist and all around good man (Please check out his Patreon). We also were able to rustle up some centroid data for the GIS boundaries for postcode areas (this is how we’re able to hopefully sort the polling locations by approximate proximity).

Through prototyping and testing we also decided we needed to add Google and Apple maps URLs with the data so you could find your nearest polling location then dive out to a maps app to get turn by turn directions.

Some Ruby scripts, cups of peppermint tea and a few hours later we’d turned the data into a big JSON file and wrapped a nice Typescript AWS Lambda endpoint around it, so it would easily scale out to thousands of concurrent requests (we used some webpack hackery to embed the JSON file into the Lambda zip so we didn’t have to call out to DynamoDB or similar).

The Outcome

The real star of the show is our Iris Platform (renamed to Pattr), with a few hours of work we were able to build together a dynamic dialogue that hooked up to the API and powered a dynamic, performant experience. Our goal at the end of the day was a super zippy experience that helped users find out voting information, where to vote and then how to get on with their day.

Let us know what you think and don’t forget to vote!

Share this article

See Pattr in Action

Pattr brings you closer to your customers.

A conversational AI SaaS platform to power, enable, enrich and understand conversations between you and your customers, in real-time and at scale.

Three things you didn’t realise Pattr offers

Read More
Online Community 101 (Preview image)

How to manage and grow a healthy online community

Read More

What are the legal implications of unwanted content?

Read More