Dogpack is a Twitter bot which automates announcing and confirming meetups of DogpatchJS. It will:
- Tweet announcing DogpatchJS the morning of the meetup
- Accept RSVPs in the form of DMs containing emoji
- Tweet a confirmation or cancellation of the event depending on how many RSVPs are received
Dogpack is hosted on Google Cloud Functions. To set up your own Dogpack:
-
Create a new project on the Google Cloud Console.
-
Create a new Twitter app key.
-
Copy
config.json.sample
toconfig.json
, and fill in:project_id
: Your Google Cloud project idconsumer_key
: Your Twitter app "Consumer Key"consumer_secret
: Your Twitter app "Consumer Secret"
-
Authenticate with Twitter:
-
Run
./scripts/setupTwitter.js
and open http://localhost:3000 in a web browser. -
Click the link and authorize your Twitter app.
-
Copy the values of
access_token_key
,access_token_secret
, andtwitter_id
into yourconfig.json
. -
Note the value of "Suggested webhook name" for the following step.
The webhook name should be a long random string (which is difficult to guess). We rely on obscurity to prevent unauthorized calls to the webhook endpoint because of a shortcoming in GCF which prevents checking request signatures.
-
-
Deploy on GCF:
- Create a Google Cloud Storage bucket for staging your functions.
- Run
BUCKET=your-storage-bucket-name HOOKNAME=your-webhook-name ./scripts/setupFunctions.sh
- Note the HTTPs trigger endpoint URL for your webhook in the output. It might be of the form:
https://region-projectname.cloudfunctions.net/your-webhook-name
. Use this in the following step.
-
Set up Twitter's DM Webhook: run
./scripts/setupWebhook.js your-webhook-https-url
You should now have a functioning bot! Test it out by triggering the "postEvent" and "postRSVPs" functions in the Cloud Functions console, or by sending it a Twitter DM.
-
Set up scheduled posting:
-
Customize
cron.yaml.sample
to suit your meetup schedule. -
Clone this Google example repo and follow the deployment instructions, adding your
cron.yaml
.Refer to this PR (if it hasn't been merged yet) for securing your App Engine deployment.
-