https://github.com/passy/tube-trains-bot
A Google Home action allowing you to ask for TfL Tube departures.
https://github.com/passy/tube-trains-bot
Last synced: about 1 year ago
JSON representation
A Google Home action allowing you to ask for TfL Tube departures.
- Host: GitHub
- URL: https://github.com/passy/tube-trains-bot
- Owner: passy
- License: bsd-3-clause
- Created: 2016-12-11T00:30:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-06-17T22:02:39.000Z (about 6 years ago)
- Last Synced: 2025-06-28T19:52:27.517Z (about 1 year ago)
- Language: Haskell
- Homepage: https://assistant.google.com/services/a/id/0b19d0985c04a36f/
- Size: 6.42 MB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tube Trains - Google Home Action [](https://travis-ci.org/passy/tube-trains-bot)

Fulfilment for an [api.ai](https://api.ai/) -powered [Actions on Google](https://developers.google.com/actions/) integration
that provides live departure times through a Google Home.

## Using
This is deployed and live! If you have a Google Home, ask activate it by saying
> Hey Google, let me talk to Tube Trains.
You can also ask it in one go:
> Hey Google, ask Tube Trains about the next departures from Euston Square.
Or something a bit more involved:
> Hey Google, at Tube Trains, tell me about the next eastbound departures on the Hammersmith & City Line from Aldgate East.
You can see it in action here:
[
](https://twitter.com/passy/status/843184619935715332)
You can also find it under the available services in the Google Home app:

## Building and Testing
Automated testing is limited at this point, types have provided sufficient help so far.
Some limited test fixtures are available for manual testing:
```
stack build
stack exec tube-bot-fulfillment
curl -vv 'http://localhost:8001/webhook' -XPOST -H "Content-Type: application/json" -d @data/test_req.json
```
There's also a small test suite you can run with `stack test`.
### Building the docker image
There's a Docker image for easier deployment, which simply wraps a statically linked
binary.
In order to build the container, please first build the static binary.
```
./build-static.sh
docker build --rm -t passy/tube-bot-fulfillment:vx.y.z .
docker push passy/tube-bot-fulfillment:vx.y.z
```
Alternatively, if building statically through the provided container doesn't work
(OOM errors or linking issues due to outdated upstream), you can build via
`stack build --docker` after adding `ld-options: -static` to the executable section
in `package.yaml`. If this turns out to be the overall more reliable way, I'll
change the script accordingly.
## Deployment
I use this [docker-compose](https://github.com/passy/tube-bot-fulfillment-deployment) config file
that I check out and run on my VPS. Maybe that'll do for you as well.