LedgerHQ / ledger-fresh-management

This is where product topics are discussed for Ledger Fresh
Apache License 2.0
14 stars 2 forks source link

[Notification center] - Plugin Email #41

Open qd-qd opened 1 year ago

qd-qd commented 1 year ago

Header

Name of the task: Plugin Email

Name of the module: Notification center

Difficulty: 3

Waiting for: #39

Body

Short description

Now that we have a server that is consumed by our "watcher module" and received notification orders, we need to do these orders. The aim of this task is to create an open-source plugin for our notification center that will be in charge to send a notification by email.

Full description

Develop a simple open-source project that can be imported into the server developed in #39 to send Email notifications. This plugin will be called by the server each time to_type is equal to email.

The plugin will receive these parameters:

type PluginParameters = {
  to: string, // define the email that will receive the notification
  message: string, // define the message to send
}

All the secrets that the plugin will need must be passed during the initialization of the plugin.

The plugin must have two exposed methods:

The send function must return the status of the external request made.

pnpm must be used as a dependency manager. A .nvmrc must be set to the LTS version of node. You can decide which library you want to use to send the email, keep the code simple, and the dependencies list as small as possible. The email should be in plain text, don't create an HTML version of it. Everything must be tested, prettied, eslinted and the README of the repository should describe the plugin.

Keep in mind the plugin will be an npm package.

Additionals ressources

github-actions[bot] commented 1 year ago

Task monitoring 📝


This is an automatic post that is intended to facilitate the follow-up of the project. This post is meant to be edited throughout the life of the project.

giovannivignone commented 1 year ago

@qd-qd I will be handling this task

qd-qd commented 1 year ago

let's goo, let me know if you need something

giovannivignone commented 1 year ago

Hey @qd-qd, so I have launched the npm package here, but there is one thing I want to change about the scope above...

The interface currently contains the following... async send(to: string, message: string) I believe we should modify this interface to look like this... async send(to: string[], message: string)

The reason for this is that AWS and other email providers maintain an interface for emitting the emails as a string array. By changing this interface it should allow us to avoid individual calls to AWS and rather batch call where necessary.