OperationCode / operationcode_backend

This is the backend repo for the Operation Code website
https://operationcode.org
MIT License
62 stars 110 forks source link

ActiveJob to send a new user notification to the PyBot #481

Closed juliantrueflynn closed 5 years ago

juliantrueflynn commented 5 years ago

Feature

Why is this feature being added?

Current ActiveJob sends new user event directly to Slack API. This logic instead can be handled entirely with PyBot.

What should your feature do?

Create ActiveJob to forward user events to PyBot. With user email and the user details like interests, mentor etc.

This task depends on ticket in PyBot to complete https://github.com/OperationCode/operationcode-pybot/issues/67

apex-omontgomery commented 5 years ago

Acceptance criteria.

  1. Uses a shared token slack_service_auth_token
  2. sends the following key value pairs from the users schema
    t.string   "email"
    t.string   "zip"
    t.boolean  "mentor",                          default: false
    t.string   "first_name"
    t.string   "last_name"
    t.string   "timezone"
    t.text     "bio"
    t.string   "state"
    t.string   "city"
    t.boolean  "volunteer",                       default: false
    t.string   "interests"
    t.string   "military_status"
  3. Retries only 5 times- faster failure and message
  4. Expects a simple status code and message. If bad status we have an error.

Final states:

  1. Success service returns -> user was invited
  2. Success service returns -> user not invited: `already_in_team
  3. Failure service returns -> any other status; force end job.
  4. Failure cannot access service; continue job tries