RESTful API exposing TFL data on London underground status in a slack-friendly fashion
It all started from:
- we need a pet project to work on where we can use Golang
- Slack is cool and it would be nice to integrate with it
And in a few days myself and Oliver Skånberg ended up creating this small Slack integration (still evolving) which is temporarily being served from a nano EC2 instance for cost saving reasons. I tried with a Kubernetes cluster on Google Cloud but for few requests per month it felt like it was a bit overkilling. The concept is simple, you ask for the tube status, and the service will reply with a nice Slack-friendly message.
This is what it looks like:
To add the integration to your Slack team, you need to push your slack token to this endpoint:
The Slack token will be generated when creating the slash command in the custom integrations section of your slack account. The endpoint to configure as target for the slash command is:
Once this is done, you can call from any channel or private chat the
/tube command. If called without arguments it will return a brief help.
/tube command provides - at this stage - two arguments (or sub-commands) that the bot can interpret:
/tube status [tubeLine](where the
tubeLineis optional). The response is not public, so the caller is the only one able to see it. Examples of valid commands are
/tube status Bakerloo.
/tube subscribe [tubeLine](here the
tubeLineis mandatory). This will store a subscription for the user in order to allow - in the near future - tube status to be queried by username, so you can check whether your colleague
@johnis late for standup because of a tube signal failure on his line!
The service is being monitored through Grafana and Prometheus, and the infrastructure should be totally fine in most cases, but should it become overloaded I’ll decide what to do.
Last but not least, the service has been developed for personal use, it’s currently under active development so there might be times when it will be unavailable.