Skip to content

kevinyou/dallas-alerts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dallas-alerts

About

This bot retrieves active police incidents from dallasopendata and posts all active incidents to a Mastodon instance.

Hosting

Alerts available at @unofficial_dpdincidents@botsin.space.

This bot runs on AWS Lambda every 2 minutes.

Redis instance hosted by Redis Enterprise.

Deduplication

Making a request to Mastodon for a duplicate incident is deduplicated first to by using a Redis cache, and then duplicate requests to Mastodon are deduplicated via Mastodon's Idempotency-Key header.

Development

To get OpenData secrets, see Socrata: Generating an App Token.

To get Mastodon secrets, log in to your Mastodon account and go to Settings -> Development.

Run Redis locally at localhost:6379, or provide remote Redis location via the REDIS_(URL|USERNAME|PASSWORD) environment variables.

nvm use
npm install
npm run build
DALLAS_ALERTS_OPENDATA_TOKEN=${your_opendata_token} \
  DALLAS_ALERTS_MASTODON_TOKEN=${your_mastodon_token} \
  npm run start

Building and Packaging for AWS Lambda

Not the most automated way:

rm -rf function
npm run build
cp -R dist function
cp package.json function/package.json
cd function
npm install --omit=dev
zip -r function.zip .