Skip to content

Instantly share code, notes, and snippets.

@geomagilles
Last active February 12, 2018 16:02
Show Gist options
  • Save geomagilles/85d5d0d3c6f3c7fadad3406c20a3e72c to your computer and use it in GitHub Desktop.
Save geomagilles/85d5d0d3c6f3c7fadad3406c20a3e72c to your computer and use it in GitHub Desktop.
var { Workflow, Wait } = require("zenaton");
var SendMyBeautfulEmail1 = require("./SendMyBeautfulEmail1");
var SendMyBeautfulEmail2 = require("./SendMyBeautfulEmail2");
var SendMyBeautfulEmail3 = require("./SendMyBeautfulEmail3");
var SendMyBeautfulEmail4 = require("./SendMyBeautfulEmail4");
var SendMyBeautfulEmail5 = require("./SendMyBeautfulEmail5");
var SendMyBeautfulEmail6 = require("./SendMyBeautfulEmail6");
module.exports = Workflow("WelcomeEmailSerie_v2", {
handle() {
new SendMyBeautfulEmail1(this.email).execute();
new Wait().monday().at('08:00').execute();
new SendMyBeautfulEmail2(this.email).execute()
new Wait().monday().at('08:00').execute();
new SendMyBeautfulEmail3(this.email).execute();
new Wait().monday().at('08:00').execute();
if (! this.activated) {
new SendMyBeautfulEmail4(this.email).execute();
new Wait().monday().at('08:00').execute();
new SendMyBeautfulEmail5(this.email).execute();
new Wait().monday().at('08:00').execute();
new SendMyBeautfulEmail6(this.email).execute();
}
},
onEvent(name) {
if (name == "UserActivatedEvent") {
this.activated = true;
},
id() {
return this.email;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment