RADAR-base / RADAR-Appserver

General purpose application server for the radar platform currently with capability to schedule push notifications
10 stars 1 forks source link

Impl. send-email endpoint #473

Closed pvannierop closed 17 hours ago

pvannierop commented 2 weeks ago

We currently are building functionality to allow sending emails from aRMT app on behalf of the study subject. The use case is that study subject are allowed to contact their assigned physician from within the app so that any problems or questions can be raised in a convenient manner.

This PR will implement a new POST endpoint /email/projects/<projectId>/users/<subjectId> endpoint. This endpoint receives a post body with structure:

{
  "to": "me@there.org",
  "cc": "you@there.org;andyou@there.org",
  "bcc": "everyone@there.org",
  "subject": "Hi!",
  "message": "How <i>you</i> doin...."
}

In response the Appserver will send the email.

The way how emails are sent is polymorphic. At present, the only method is by using the Firebase Trigger Email from Firestore extension. This method involves placing a JSON document in the Firebase database collection. The extension is configured to send emails from this database collection.

In the future, we can implement a way to directly send emails from Appserver. This would require to register SMTP server credentials in the service.

Remarks

pvannierop commented 17 hours ago

Closing this. Superseeded by #474