A Cloudflare Worker that fetches emergency incident data from PulsePoint and posts it to Discord channels via webhooks.
This project uses Cloudflare Workers and Cloudflare's Workflow API to:
- Fetch incident data from PulsePoint's API on a scheduled basis
- Decrypt and process the incident data
- Filter incidents by location
- Post new incidents to Discord via webhooks
- Track and update existing incidents
Thanks to Davnit for the original logic for decrypting the PulsePoint data.
- Scheduled Polling: Automatically checks for new incidents every 2 minutes
- Location Filtering: Only processes incidents in specified locations (Vancouver, Burnaby, New Westminster, etc.)
- Incident Type Handling: Routes different types of incidents to different Discord channels
- Persistent Storage: Uses Cloudflare KV to track incidents across worker invocations
- Manual Controls: HTTP endpoints for triggering workflows and managing incident tracking
- Node.js (v16 or later)
- A Cloudflare account with Workers and KV enabled
- Discord webhook URLs
- 
Clone this repository git clone https://github.com/yourusername/pulsepoint-to-discord.git cd pulsepoint-to-discord
- 
Install dependencies npm install 
- 
Set up your KV namespace in Cloudflare npx wrangler kv:namespace create PULSEPOINT_KV 
- 
Update wrangler.tomlwith your KV namespace ID and Discord webhook URLs
Run the worker locally:
npm run devDeploy to Cloudflare Workers:
npm run deployThe worker exposes the following HTTP endpoints:
- GET /- Shows usage instructions
- POST /trigger- Manually triggers the workflow
- GET /latest-id- Gets the latest incident ID that was processed
- POST /reset-id- Resets the latest incident ID (send JSON with "id" field)
- GET /?instanceId=xxx- Checks the status of a workflow instance
Configuration is managed through wrangler.toml:
- name- The name of your Cloudflare Worker
- kv_namespaces- KV namespace binding for storing incident data
- vars- Environment variables (Discord webhook URLs)
- triggers- Cron schedule for automated execution
- observability.logs- Logging configuration
This project is licensed under the MIT License.