Skip to content

Support different "originators" of member invitations #623

@maxceem

Description

@maxceem

Context

We have functionality to invite members to the Topcoder Projects inside Connect App which looks like this. When users are invited they also receive a email notifications with links to accept or decline invitation as on screenshot. This email is styled for Connect App, and links to decline and accept invitation lead to Connect App. At the moment we are implementing functionality to invite members to the same Topcoder Projects inside another application called TaaS App. It uses the same Projects API to invite members. As a result user get the same emails with links to Connect App.

General Task

We have to update Projects API and related services so when invited members we can indicate which application invited members so users would get different email notifications with links and styles for the corresponding application Connect App or TaaS App.

Current Workflow

  • User creates invite in Projects API via endpoint "POST /v5/projects/:projectId/invites"
  • Projects API sends 2 Kafka Events:
    • Event for Notifications Service "connect.notification.project.member.invite.created" (source code) - for each invite by email or by handle.
    • Event for Email Service "connect.notification.email.project.member.invite.created" (source code) - only if user doesn't exist yet and is invited by email.
  • Notifications Service listens to this Kafka Event "connect.notification.project.member.invite.created" and if email notifications are enabled for the user it send another Kafka Event "connect.notification.email.project.notifications.generic" to the Email Service (source code).
  • Email Service consumes these events "connect.notification.email.project.member.invite.created" and "connect.notification.email.project.notifications.generic" and sends email using Sendgrid.
  • Email is send using a template that we put into the Sendgrid config. This template we generate using code inside Notification Service, see its README.

Task Details

  1. Update endpoint "POST /v5/projects/:projectId/invites" so it accepts an optional query param "originator". This param would define which service is invited user.
  2. Pass this param inside payloads of the Kafka Events so we can know the value inside Email Service and it should pass this value to the Sendgrid
  3. Update code inside https://github.com/topcoder-platform/tc-notifications/tree/dev/emails so we can have multiple folders there for each "originator". For now we would have folders "connect" and "taas". Put all the current templates into "connect". And create a copy of the same templates for "taas". Iniside "taas" folder only keep templates for invites, and remove all other templates as we don't send emails for "taas" in other cases. Update the code of invite templates for "taas" so it all the texts says "TaaS App" instead of "Connect". And all the links lead to the TaaS App, instead of the Connect App.
  • Update template generation logic. The final template which is generate should include templates for Connect App and for TaaS App inside, because we are putting this template into Sendgrid in one place. This final template should generate email for Connect App or TaaS App based on the value of the "originator" which is send from Email Service to Sendgrid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions