Obviously, this is not very advanced in terms of natural language processing, but the domain is a simple one and the number of forms that a query requesting this sort of information might take will probably be quite simplistic – and predictable!

Having extracted the member’s name (for a lookup of the committees a member is on) or the committee name when trying to look up the members of a particular committee), a URL is generated that can request the data from the Parliament members API. For example:

This text string can then be returned to Slack as the slash command response.

[UPDATE…] Here’s another example… The members’ API can look up MP by location, constituency or postcode; so if we try them in turn, we can take in a wide variety of location styles; and it only takes a really simple regular expression to prime the pattern match for what I guess is a wide range of possible conversational gambits for requesting this information:

As with the members API, the Parliament data API will also return JSON responses to valid queries (I used the Parliament data API in the original Hook.io demo). There’s quite a few APIs to play with – data.parliament.uk datasets so as and when I get a moment, I may try to code some more of them up as conversational responders:-)

One thought on “Sketching a Slack Slash Parliamentary Auto-Responder Using AWS Lambda Functions”

This is really cool and should be the future of Open Data interfaces. People shouldn’t have to download a dataset to get key insights from it, and they shouldn’t have to decypher labels to create a custom visualisations, which is the state of the art of “accessible” open data portals today.

Would it be easy to query a google spreadsheet using this method? That sounds like a great way for a team member to query internal data that s/he might not be acquainted with.