line

Product Return

This Workflow optimizes a customer product return process by automating customer support internal processes and interfacing with external services: Chronopost, Sengrid, Zendesk and TrustPilot API. We create the return inside our internal application, generate and email a 'return parcel' and send a personalised email to the customer depending on their status and return parameters. Depending on the reason for the return, there might be a follow up action such as assigning an account manager to reach out or asking the customer for a review when the product has been exchanged.

Visual of Workflow

This flowchart shows a visual representation of the workflow tasks.
line

Workflow Steps

  • Identify the reason for the return
  • Create a parcel return in our internal application
  • Grab parcel data and generate a QR code with Chronopost API
  • Check the reason for the return and send an email template via Sendgrid using the right template and attach QR code from chronopost
  • Depending on the reason for the return, trigger specific tasks such as "Assign an Operator" or "Ask for a Review"
  • Wait for up to three days to receive an external event that the user shipped the product
  • If it has been shipped, the workflow is completed
  • If not, an email reminder subworkflow is launched to remind the user to send the parcel and follow up if they do not

Workflow Code

This workflow is the code that orchestrates tasks (through the Zenaton workflow engine) and executes them on your servers. Tasks inside the workflow are not detailed here.

const { workflow, duration } = require("zenaton");

module.exports = workflow("ProductReturnWorkflow", {
  *handle(parcelReturn) {
    const sendgrid = this.connector('sendgrid', 'your-connector-id');
    this.parcelReturn = parcelReturn;

    const email = this.parcelReturn.email;

    yield this.run.task("CreateReturnParcel", this.parcelReturn);

    const status = yield this.run.task("GetParcelData", this.parcelReturn);

    if (status === "status_1") {
      sendgrid.post('/mail/send', {body: {"template_id": "template_1", ...}})
      this.run.task("AssignSupportOperatorZendesk");
    } else if (status === "status_2") {
      sendgrid.post('/mail/send', {body: {"template_id": "template_2", ...}})
      this.run.task("AskReviewTrustPilot");
      // else if (status === 'xxx') {
      //   sendgrid.post('/mail/send', {body: {"template_id": "template_xxx", ...}})
      // }
    } else {
      sendgrid.post('/mail/send', {body: {"template_id": "template_x", ...}})
    }

    const shipped = yield this.wait.event("Shipped").for(duration.days(3));

    if (!shipped) {
      yield this.run.task("EmailReminderWorkflow");
    }
  }
});

Workflow Executions

View the real-time tasks executions of this workflow.
line