OperationCode/operationcode_backend

ActiveJob to send a new user notification to the PyBot

juliantrueflynn opened this issue · 1 comments

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 OperationCode/operationcode-pybot#67

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"
  1. Retries only 5 times- faster failure and message
  2. 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