Display the next departures at any SNCF train station.
Find a file
2022-09-10 21:34:36 +02:00
.gitignore Initial commit 2022-09-08 21:01:55 +02:00
build.sh Add README 2022-09-09 08:32:07 +02:00
Dockerfile Initial commit 2022-09-08 21:01:55 +02:00
LICENSE Add README 2022-09-09 08:32:07 +02:00
README.org Read the SNCF authentication key from an environment variable 2022-09-09 22:45:13 +02:00
sncf.ss Handle missing disruption messages 2022-09-10 21:34:36 +02:00

SNCF Bot

Usage

Get an access to the SNCF API. By creating an account, you should receive an email with your authentication key.

The program reads the authentication key from the SNCF_AUTH_KEY environment variable.

$ export SNCF_AUTH_KEY=<sncf-key>
$ sncf
┌────────────┬────────────────────────────────┬───────────────┐
│ Réseau     │ Direction                      │ Heure         │
├────────────┼────────────────────────────────┼───────────────┤
│ TRANSILIEN │ Paris Saint-Lazare (Paris)     │ 08:41         │
│ TER        │ Paris Saint-Lazare (Paris)     │ 08:54         │
│ TER        │ Rouen Rive Droite (Rouen)      │ 09:07         │
│ TRANSILIEN │ Paris Saint-Lazare (Paris)     │ 09:41         │
│ TER        │ Paris Saint-Lazare (Paris)     │ 09:55         │
│ TER        │ Paris Saint-Lazare (Paris)     │ 10:58         │
│ TER        │ Rouen Rive Droite (Rouen)      │ 11:05         │
│ TRANSILIEN │ Paris Saint-Lazare (Paris)     │ 11:37         │
│ TER        │ Paris Saint-Lazare (Paris)     │ 12:56         │
│ TER        │ Rouen Rive Droite (Rouen)      │ 13:06         │
└────────────┴────────────────────────────────┴───────────────┘

If you want to publish to Mattermost, create an incoming webhook by going to Product menu (top left) → IntegrationsIncoming webhooks.

Use the --mattermost-url option to set the webhook URL and post to Mattermost. Optionally, you can override the default channel of the webhook with --channel.

Building instructions

The build script will use Docker to build a fully static executable. The Dockerfile is based on the gerbil/alpine image.

$ ./build.sh