thzinc / eo13792bot

"I'm a bot that quotes from public comments to Ryan Zinke because of Executive Order 13792. Tell him something at http://l.thzinc.com/doi20170002"

Home Page:https://twitter.com/eo13792bot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EO 13792 Bot

"I'm a bot that quotes from public comments to Ryan Zinke because of Executive Order 13792. Tell him something at http://l.thzinc.com/doi20170002"

This repo represents two Auth0 Webtasks that run on a schedule: the quoter and the needler.

Quoter

The Quoter pulls recent public submissions from Regulations.gov on docket DOI-2017-0002 ("Review of Certain National Monuments Established Since 1996; Notice of Opportunity for Public Comment"). It does some very simple sentiment analysis on the text of the comments to find the most "negative" sentence within the comment and use that as the quote to tweet. It also uses a basic MD5 hash as a key to filter out comments that have been previously tweeted.

Example tweet

Once these lands are gone, there is no bringing them back or replacement. #EO13792 https://t.co/4NaHP8DdvP

— EO 13792 Bot (@EO13792Bot) June 9, 2017

Needler

Turned off Needler due to spammy behavior

The Needler pulls tweets by the Quoter and retweets them with a randomly-chosen madlib-style tweet to one of several Department of Interior or Ryan Zinke Twitter accounts.

Example tweet

Hey @DOIPressSec, this person took time out of their day to talk to you about your review of National Monuments. https://t.co/55EOErqLBM

— EO 13792 Bot (@EO13792Bot) June 9, 2017

Contributing

Each of the Webtasks are implemented as separate npm modules.

Set up

  • Sign up for Auth0 Webtasks
  • Grab the Webtask CLI: npm install wt-cli -g
  • Init the Webtask CLI: wt init
  • Create a Twitter app
  • Sign up for a Data.gov API key
  • Copy .secrets-template file to .secrets and fill it in with your data from above

.secrets variables

  • REGULATIONS_GOV_API_KEY
    • Data.gov API key
  • TWITTER_CONSUMER_KEY
    • Twitter app consumer key
  • TWITTER_CONSUMER_SECRET
    • Twitter app consumer secret
  • TWITTER_ACCESS_TOKEN_KEY
    • Twitter access token key
  • TWITTER_ACCESS_TOKEN_SECRET
    • Twitter access token secret
  • TWITTER_SCREEN_NAME
    • Twitter screen name associated to the access token

Development workflow

  • Change directory to the Webtask you wish to work on
  • npm install to install dependencies
  • npm run start to publish the Webtask and watch for file changes
    • The URL to the webhook will be printed to the console

When you are done with development, schedule the Webtask to run regularly with npm run publish.

About

"I'm a bot that quotes from public comments to Ryan Zinke because of Executive Order 13792. Tell him something at http://l.thzinc.com/doi20170002"

https://twitter.com/eo13792bot

License:MIT License


Languages

Language:JavaScript 100.0%