Get the FREE Ultimate OpenClaw Setup Guide →
H

Korea metropolitan bus alerts

Verified

@Hsooooo

npx machina-cli add skill @Hsooooo/korea-metropolitan-bus-alerts --openclaw
Files (1)
SKILL.md
5.0 KB

수도권 버스 도착 알림 (Clawdbot cron)

Scheduled bus arrival alerts powered by 국토교통부 TAGO OpenAPI.

This skill is designed for users running Clawdbot Gateway + Clawdbot cron. Users register rules like:

  • "평일 오전 7시, 인천 한빛초등학교, 535"
  • "평일 오후 5시30분, 고양 향동초등학교, 730, 503"

Then the system sends arrival summaries to the registering user (DM) on schedule.

Note (MVP): stop resolution is done via stop name search (cityCode + keyword). GPS-based nearby lookup exists but may return 0 results depending on key/region.

Prerequisites

  • A running Clawdbot Gateway (Telegram/Slack/etc. already configured)
  • Clawdbot cron enabled/usable
  • A data.go.kr API key for TAGO
  • (setup 자동화 사용 시) systemctl --user 가 동작하는 환경 (systemd user service)
  • (rule_wizard에서 cron 등록까지 하려면) clawdbot CLI

One-time setup: TAGO API key

You must set a TAGO service key in your environment (never commit or paste it into markdown).

Recommended env var:

  • TAGO_SERVICE_KEY

Option A (fastest): one-off test in your current shell

Good for quick manual tests; cron jobs will NOT inherit this unless the Gateway service has it.

export TAGO_SERVICE_KEY='...'

Option B (recommended): one-command setup (auto-detect systemd unit)

This is the most “set it once and forget it” flow.

Run:

python3 korea-metropolitan-bus-alerts/scripts/setup.py

If your network blocks the endpoint or TAGO returns 403 during the smoke test, you can still complete setup:

python3 korea-metropolitan-bus-alerts/scripts/setup.py --skip-smoke

It will:

  • Auto-detect your Gateway systemd user service (supports custom unit names)
  • Prompt for TAGO_SERVICE_KEY (hidden input)
  • Save it to ~/.clawdbot/secrets/tago.env (chmod 600)
  • Write a systemd override to load that env file
  • Restart the Gateway
  • Run a small TAGO smoke test

(Advanced/manual) If you prefer shell scripts, korea-metropolitan-bus-alerts/scripts/set_tago_key.sh is still available, but setup.py is the recommended UX.

Safety notes

  • Never commit .env / tago.env.
  • Avoid sharing outputs of docker compose config or similar commands that may print env values.

Quick start

A) Test TAGO connectivity (manual)

export TAGO_SERVICE_KEY='...'
python3 korea-metropolitan-bus-alerts/scripts/tago_bus_alert.py nearby-stops --lat 37.5665 --long 126.9780

B) Register an alert rule (interactive)

Tell the agent something like:

  • "평일 07:00, 인천 한빛초등학교, 535 알림 등록해줘"

If the stop name is ambiguous (e.g., opposite side of road), the agent MUST ask a follow-up question to pick the correct direction/stop candidate before creating the rule.

C) List rules

  • "버스 알림 목록 보여줘"

D) Delete a rule

  • "버스 알림 3번 삭제해줘" (confirm before delete)

E) Test a rule (run now)

  • "방금 등록한 규칙 테스트해줘" (one-time message)

Supported schedule expressions (MVP)

  • 매일 HH:MM
  • 평일 HH:MM
  • 주말 HH:MM

(Phase 2: arbitrary cron expressions)

Cron implementation notes

  • Use isolated cron jobs (sessionTarget: isolated) + deliver: true.
  • Delivery is DM-only to the registering user.
  • See references/cron_recipe.md and scripts/cron_builder.py.

Interactive registration helper (server-side)

For integration testing (and for power users), use:

  • scripts/rule_wizard.py register

It will:

  1. Ask for schedule/time/routes
  2. Resolve stop candidates via GPS nearby lookup (direction disambiguation)
  3. Generate the job JSON
  4. Optionally call clawdbot cron add to register it

Data source

Single provider only (MVP):

  • 정류장 조회: BusSttnInfoInqireService (15098534)
  • 도착 조회: ArvlInfoInqireService (15098530)

Safety / Security

  • Never write API keys/tokens/passwords into markdown files.
  • For browser automation on logged-in pages: require explicit user confirmation.
  • For destructive operations (cron delete): confirm before acting.
  • DM-only delivery (MVP): do not broadcast to groups/channels.

Implementation notes

  • Prefer scripts under scripts/ for deterministic behavior.
  • Put detailed API field mappings in references/api_reference.md.

Deterministic helper script

Use scripts/tago_bus_alert.py for deterministic TAGO lookups:

  • nearby-stops (GPS → stop candidates)
  • arrivals (cityCode+nodeId → arrivals; optional route filtering)

Source

git clone https://clawhub.ai/Hsooooo/korea-metropolitan-bus-alertsView on GitHub

Overview

Automates bus arrival summaries for 수도권 using 국토교통부 TAGO OpenAPI and Clawdbot cron. Users register weekday/weekend rules like 평일 오전 7시, <정류소명>, <노선들> and receive DM-delivered summaries on schedule. The MVP uses stop name search for stop resolution; GPS-based nearby lookup exists but may return 0 results depending on key and region.

How This Skill Works

Users configure rules through Clawdbot Gateway and cron. The system queries TAGO OpenAPI for arrivals, builds a concise summary, and sends it via DM to the registered user. Prerequisites include a TAGO API key (TAGO_SERVICE_KEY) and, if automating, a systemd user service to run cron jobs.

When to Use It

  • 매일 HH:MM 형식으로 버스 도착 알림을 받고 싶을 때
  • 평일 HH:MM 형식으로 주중 전용 알림을 설정할 때
  • 주말 HH:MM 형식으로 주말 알림을 설정할 때
  • 정류소 이름이 모호할 때 방향/정류소 후보를 확인해야 할 때
  • TAGO API 키를 설정하고 Clawdbot cron으로 자동 배치를 구성하려 할 때

Quick Start

  1. Step 1: export TAGO_SERVICE_KEY='...' and test connectivity: python3 korea-metropolitan-bus-alerts/scripts/tago_bus_alert.py nearby-stops --lat 37.5665 --long 126.9780
  2. Step 2: 등록할 규칙을 대화형으로 입력해 알림 등록: 예) 평일 07:00, 인천 한빛초등학교, 535 알림 등록해줘
  3. Step 3: 등록된 규칙을 테스트해 알림이 즉시 도달하는지 확인: 방금 등록한 규칙 테스트해줘

Best Practices

  • 정확한 정류소명과 노선 번호를 함께 입력해 중복 가능성을 최소화한다
  • 매일/평일/주말 표현을 사용해 예측 가능한 스케줄을 구성한다
  • TAGO_SERVICE_KEY를 안전하게 보관하고 코드에 하드코딩하지 않는다
  • GPS 근접 조회는 보조로만 활용하고 해상도를 확인한다
  • 규칙 마법사(rule_wizard)로 방향/정류소 후보를 명확히 해서 등록 실패를 줄인다

Example Use Cases

  • 평일 07:00, 인천 한빛초등학교, 535 알림 등록해줘
  • 평일 오후 5:30, 고양 향동초등학교, 730, 503
  • 주말 09:15, 서울역, 100 알림 등록해줘
  • 매일 06:00, 판교역, 101 알림 등록해줘
  • 평일 08:45, 송도역, 350 알림 등록해줘

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers