Strapi Newsletter

Hello everyone,

Im trying to build custom newsletter database with strapi.
Does anyone have some suggestion or if there is maybe template?

Steps:

  1. customer subscribe to newsletter on front-end
  2. customer gets link in email to confirm
  3. customer is subscribed to newsletter and in every email is link to unsubscribe from newsletter

1.Create a content-type subscribers, with fields: email(string), activated(boolean, default value false), token(string). From front-end, when user subscribes, create a new entry in subscribers with his email, activated:false and generate a random token based on his email. To generate the token use lifecycles (beforeCreate or afterCreate). In afterCreate lifecycle add a function that sends the email confirmation with an url, that contains this token.

  1. Creat a new get route, something like: /confirm-subscription, then create a custom controller, that gets the token parameter from url and updates the subscription’s field activated from false to true.

  2. Same approach as in step 2, create a new route like /cancel-subscription with a custom controller, that updates the subscription field activated from true to false.