Sign inSign up

jochman/slack-alert

By jochman

•Updated 8 months ago

Change slack's status by Pikud HaOref alerts

Image
Monitoring & observability
0

781

jochman/slack-alert repository overview

⁠Slack Status by Alert

Automatically updates your Slack status when a Pikud HaOref⁠ (Israeli Home Front Command) alert is active in your city.

  • Real alerts (category 1 — rockets/missiles): sets a 🚨 status
  • Warnings (other categories — hostile aircraft, etc.): sets a ⚠️ status
  • Status is cleared when a category 13 (clear) event is received
  • Graceful shutdown clears your status immediately

⁠Setup

⁠1. Slack token
  1. Go to api.slack.com/apps⁠ → Create New App → From scratch
  2. Under Features > OAuth & Permissions, add a User Token Scope: users.profile:write
  3. Click Install to Workspace and copy the xoxp-* token
⁠2. Configure
cp .env.example .env

Edit .env:

SLACK_TOKEN=xoxp-your-token
ALERT_CITY=תל אביב        # Hebrew, exact match with Pikud HaOref city name
⁠3. Run
npm install
npm start

Or with Docker — edit docker-compose.yml to set your token and city, then:

docker compose up -d
docker compose stop   # graceful shutdown, restores your Slack status

Note: Must run from an Israeli IP. The Pikud HaOref API blocks international requests.

⁠Configuration

VariableDefaultDescription
SLACK_TOKENrequiredOne or more xoxp-* tokens (comma-separated), each with users.profile:write
ALERT_CITYrequiredCity name in Hebrew, exact match
POLL_INTERVAL5000Polling interval in ms
HTTP_PROXY—HTTP proxy (e.g. for routing through an Israeli IP)
ALERT_STATUS_EMOJI:rotating_light:Emoji for category 1 alerts
ALERT_STATUS_TEXTTaking cover! Alert in my area!Status text for category 1 alerts
WARNING_STATUS_EMOJI:warning:Emoji for non-category-1 alerts
WARNING_STATUS_TEXTMight need to take cover soonStatus text for warnings

⁠City name

ALERT_CITY must match Pikud HaOref's spelling exactly (Hebrew). If your status isn't triggering, check the logs — when an alert is active the service logs the title and description, which can help verify the city name.

⁠Development

npm test                          # run tests
MOCK_ALERTS_FILE=src/alerts.json npm start   # run with mock alert data

Tag summary

Content type

Image

Digest

sha256:4a02e6d3d…

Size

53.2 MB

Last updated

8 months ago

docker pull jochman/slack-alert