Initialising a Return

Example initialisation flow

Prerequisites

Before initialising the returns portal, the delivery status card should be configured to show the user the status of their order.

If the order is eligable for a return, configure the delivery status card to display the "Return" button, which the user can click to request a return.

When a return is requested, the following chat event is sent to flow:

{
    "type": "chat_event",
    "payload": {
        "name": "returnRequested"
    }
}

If the return is overdue (user has missed the return window), please display the return overdue component.

1. Create Returns Flow

In your customers dashboard, create a new flow, the name should be something along the lines of Returns Master.

Give the flow a unique External Account Key - ensure there are no spaces.

2. Get Order Number

Within the chat flow, capture the users order number, we recommend using a form component.

3. Send Initialise Message

Once we have the relevent order number, we can initialise the returns portal.

Add an Advanced Chat Activity with the following properties:

{
  "type": "initialise_return",
  "returnFlowId": "*****", // id of the flow created in step 1
  "externalAccountKey": "*****", // the external account key of the flowcreated in step 1
  "inputs": {
    "order_number": "*****" // the order number collected in Step 2
  }
}

The returns flow will be executed with any properties defined in the inputs object. But only order_number is required.

E.g.

{
  "type": "initialise_return",
  "returnFlowId": "*****",
  "externalAccountKey": "*****",
  "inputs": {
    "order_number": "*****", // required
    "step_type": "return_details", // (optional) initialise the returns portal on a specific step. Defaults to product_selection
    "custom_property": "some_value" // (optional) any additional properties to be passed to the returns flow
  }
}

4. Handle Failed Initialisation

If for whatever reason an error occurs during initialisation, the flow should send an initialise_return_error message.

This is displayed as an error popop in the widget.

{
  "type": "initialise_return_error",
  "message": "We are sorry but your order could not be processed at this time!"
}

What’s Next