Simple Ansible Playbooks that demonstrate how zuginfo.nrw's API can be used to send infos concerning railway lines to custom WebPush or UnifiedPush endpoints.
Find a file
2026-01-06 21:41:42 +01:00
zuginfo_playbooks whoops, fix some missing characters 2026-01-06 21:35:05 +01:00
.gitignore add .gitignore 2026-01-06 20:47:35 +01:00
README.md explain the intention 2026-01-06 21:41:42 +01:00

zuginfo_nrw_webpush_ansible

Simple Ansible Playbooks that demonstrate how zuginfo.nrw's API can be used to send infos concerning railway lines to custom WebPush or UnifiedPush endpoints.

I know this is not polished and good-looking code, this is intended as a quick demonstration on how this API could be used, nothing more than that.

How to Use

Creating an account

Run the Playbooks using Ansible:

cd zuginfo_playbooks
ansible-playbook zuginfo_api_create_account.yml

Save the values to files/account.txt before you continue.

Example:

account:
  aid: "12345"
  mysterious_id: "12345"

Create Subscription to your WebPush Endpoint

Amend files/account.txt:

account:
  aid: "12345"
  mysterious_id: "12345"
  push_endpoint: "https://example.org/up/push/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  push_key_auth: "auth_secret"
  push_key_p256dh: "auth_key"

Run the Playbook:

ansible-playbook zuginfo_api_create_webpush_subscription.yml

This will return user_id and channel_id. Amend files/account.txt.

account:
  aid: "12345"
  mysterious_id: "12345"
  push_endpoint: "https://example.org/up/push/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  push_key_auth: "auth_secret"
  push_key_p256dh: "auth_key"
  user_id: "12345"
  channel_id: "12345"

Subscribing to a specific railway line

to do

Also requires line_id.

Finding line_id for a specific railway line

to do

Updating a subscription

to do

Random Notes

  • user_id seems to change when all subscriptions are deleted and a new one is added
  • channel_id seems to change when all subscriptions are deleted and a new one is added
  • subscriptions have to be deleted before an account can be deleted

Contact Me

Got Questions? Contact me.

XMPP: xmpp:erebion@erebion.eu