Pikud HaOref → Slack Alert Bot
March 3, 2026 · View on GitHub
Polls the Israeli Home Front Command (Pikud HaOref) API for real-time rocket and emergency alerts and posts them to a Slack channel.
Architecture
| Deployment | How | Polling interval | Cost |
|---|---|---|---|
| AWS Lambda (recommended) | EventBridge triggers Lambda every minute in il-central-1 (Tel Aviv) | 1 min | Free tier |
| Docker / local | Long-running container, polling loop | Configurable (default 10s) | Self-hosted |
The Oref API blocks requests from non-Israeli IPs. AWS
il-central-1(Tel Aviv) works reliably.
Option A — AWS Lambda (recommended)
1. Create a Slack Incoming Webhook
- Go to api.slack.com/apps → Create New App → From scratch
- Name it (e.g.
Pikud HaOref Bot) and select your workspace - Sidebar → Incoming Webhooks → toggle On
- Add New Webhook to Workspace → choose a channel → Allow
- Copy the webhook URL:
https://hooks.slack.com/services/T.../B.../...
2. Create an AWS IAM user for deployments
- Go to AWS IAM Console → Users → Create user
- Name:
github-actions-deployer - Attach policies directly — add all of:
AWSLambdaFullAccessAmazonSSMFullAccessCloudFormationFullAccessIAMFullAccessAmazonS3FullAccessAmazonEventBridgeFullAccess
- Create an Access Key → use case: Third-party service → copy the Key ID and Secret
3. Add GitHub repository secrets
Go to github.com/zitzman/pikud-haoref-bot → Settings → Secrets → Actions → New secret:
| Secret | Value |
|---|---|
AWS_ACCESS_KEY_ID | from step 2 |
AWS_SECRET_ACCESS_KEY | from step 2 |
SLACK_WEBHOOK_URL | from step 1 |
4. Deploy
Push any change to main — GitHub Actions will build and deploy automatically to il-central-1.
To trigger a manual redeploy:
git commit --allow-empty -m "Trigger redeploy" && git push
5. View logs
AWS Console → Lambda → pikud-haoref-bot → Monitor → View CloudWatch logs
Or: CloudWatch → Log groups → /aws/lambda/pikud-haoref-bot
Make sure the region is set to il-central-1 (Tel Aviv).
Option B — Docker (local / self-hosted)
Only works from an Israeli IP. Suitable for running on a home server in Israel.
1. Configure environment variables
cp .env.example .env
# Edit .env and set SLACK_WEBHOOK_URL
2. Run
docker compose up -d
docker compose logs -f
Stop
docker compose down
Testing
Send a fake alert to Slack without waiting for a real one:
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/... python3 test_alert.py
Alert categories
| Emoji | Type |
|---|---|
| 🚀 | Missile / Rocket fire |
| 🛸 | UAV / Drone intrusion |
| ✈️ | Hostile aircraft |
| 🌍 | Earthquake |
| ☣️ | Hazardous materials |
| 🌊 | Tsunami |
| ☢️ | Nuclear threat |
| 🔫 | Terrorist infiltration |
Alert titles and shelter instructions are translated from the Hebrew API response. City names are translated where known and fall back to Hebrew for unmapped locations.
How it works
- AWS Lambda is triggered by EventBridge every minute
- The function fetches
https://www.oref.org.il/WarningMessages/alert/alerts.json - The last-seen alert ID is stored in SSM Parameter Store for deduplication
- On a new alert: formats a Slack Block Kit message and POSTs to the webhook
- When the alert clears (empty response): resets SSM state so the next alert always fires