Skip to content

rlisagor/ahv-council-thing

Repository files navigation

This thing mails letters to City Council.

Set up dev environment

  1. Set up an AWS account.

  2. Set up AWS keys on your machine.

  3. Install node

  4. Install serverless:

     npm install -g serverless
    

Configure environment and deploy

  1. Authorize AWS SES to send from your desired domain.

  2. If you want to send to non-verified email addresses, request to move out of the sandbox. Otherwise, verify the email you're sending to.

  3. Create a new env file, named: env.<env name>.yml (e.g. env.dev.yml). See example

  4. Set up Slack

    1. Go to https://api.slack.com/apps
    2. Create a new app and attach it to your team
    3. Enable incoming webhooks for the app and select the channel that you want to post to. Copy the webhook URL into the env file.
    4. From the "basic information" tab, copy the verification token into the env file.
  5. Deploy the Lambda functions

     serverless deploy -s <env name>
    
  6. Copy the Lambda URLs that serverless prints out:

    • Enable interactive messages for the Slack app. Copy the URL of the approve function into the interactive messages request URL.
    • Copy the URL of the submit function into the code that is placed into NationBuilder.
  7. Insert the code snippets into NationBuilder (see example)

  8. (Optional) Set up a Slack slash command to point to the slash endpoint URL.

How it works

The system consists of several parts:

  • The form in NationBuilder (see example)
  • 4 AWS Lambda functions (submit, approve, slash, and processSlashCommand)
  • The Slack application
  • (Optional) An S3 bucket for logging. Because we log in a consistent JSON format, you can use AWS Athena to query logs. We provide a Slack slash command to do this.

The workflow:

  1. User fills in form on NationBuilder
  2. The submission goes to the submit Lambda function.
  3. This function sends a request to the Slack app, this is posted on a Slack channel
  4. Someone from the group reads the submission and clicks "Approve"
  5. Slack sends a request to the approve Lambda function.
  6. The function uses AWS SES to send the email.
  7. If enabled, the function writes a JSON file containing the letter details to the S3 bucket.

About

This thing mails letters to City Council.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •