line

New User Activation Workflow

Increases conversion by automatically sending a sequence of emails to a new user if they have not completed an activation 'event' within an application within specified time frames..

Workflow Logic

Here is a sample Zenaton project that sends a sequence of emails to a new user if they have not completed a designated activation 'event' within an application. This might be installing something or completing a task or creating their first project.

A workflow instance would be dispatched for the user when they register and then immediately start a series of 'wait' steps in which the workflow waits for a designated time for the user to complete the activation. After each wait, if the event has not been received, the workflow triggers a step that sends an email offering help.

If the user completes the activation event, then we send a congratulatory email and send an internal slack message to notify the team.

View the Github project where you can fork the project and deploy to Heroku in a few clicks.

When a new user registers, we start a new "NewUserWorkflow instance for that user.

app.post('/api/register', function (req, res) {
  console.log(`Register a new user: ${req.body.email}`)
  const user = { ...req.body }

  // Launch the 'OnboardingWorkflow' Zenaton Workflow.
  // We pass the user as a parameter to this new workflow instance.
  // the withTag function is used to give the new instance an ID
  // so we will be able later to send an event to it.
  client.run.withTag(user.email).workflow('NewUserWorkflow')

  res.json()
})

We will send each product event to the specific user's workflow instance from within our web_app.

app.post('/api/event', function (req, res) {
  console.log(`Send the event '${req.body.event.name}' for the user '${req.body.email}'`)

  // Send an event to a Zenaton Workflow instance
  client.select
    .workflow('NewUserWorkflow')
    .withTag(req.body.email)
    .send(req.body.event.name, req.body.event.data)

  res.json()
})

Workflow Code

module.exports = {
  *handle(user) {
    // to be used in `onEvent` function
    this.user = user

    // Waiting for ACTIVATION_WAIT_1 seconds
    yield this.wait.for(1 * process.env.ACTIVATION_WAIT_1);

    // If user does not activate within time frame, 
   //send an email to propose to read the docs
    yield this.run.task('SendEmail', {
      to: user.email,
      subject: 'Need some help?',
      content: 'Look at our documentation...'
    })

    // Waiting for ACTIVATION_WAIT_2 seconds
    yield this.wait.for(1 * process.env.ACTIVATION_WAIT_2);

    // If user does not activate within time frame, 
   //send an email to propose to setup a call
    yield this.run.task('SendEmail', {
      to: user.email,
      subject: 'Happy to discuss',
      content: 'Please setup a call...'
    });

    // Waiting for ACTIVATION_WAIT_3 seconds
    yield this.wait.for(1 * process.env.ACTIVATION_WAIT_3);

    // If user does not activate,
   // send an email to ask for feedback
    yield this.run.task('SendEmail', {
      to: user.email,
      subject: 'What did happen?',
      content: 'Please tell us what we can change...'
    });
  },
  *onEvent(name, ...data) {
    if (name === "userActivated") {
      // Send an email to congratulate the user and give him resources for real examples.
      this.run.task('SlackUserActivated', `${this.user.email} is actived :)`);

      // Send an email to congratulate the user and offer resources for next steps.
      this.run.task('SendEmail', {
        to: this.user.email,
        subject: 'Congrats!',
        content: 'Look at our advanced examples...'
      })

      // Terminate the workflow to prevent sending more emails
      this.terminate();
    }
  }
};

View the Github project where you can fork the project and deploy to Heroku in a few clicks.