When initializing a flow you have the option to supply an onComplete function to be called prior to your subscriber exiting the flow.

The onComplete function is called prior to any exit actions defined within your flow and is executed for all paths that result in the user leaving the flow:

  • Canceled
  • Incomplete
  • Accepted a Response

The function will receive a single argument - the results of the flow. If the function returns a Promise, Raaft will wait for it to be resolved before continuing.

Here's what a typical promise based onComplete function would look like:

raaft('startCancelFlow', 
    subscriptionId: 'fdak4k3k4223m',
    authKey: '<security-token>'
    //...
    onComplete: function (result) {
        return new Promise(function (resolve, reject) {
            // example: retrieve new data and update UI
        });                
    }
}

The result object has all the details of what your customer did during their retention flow. The main value you'll want to look for is result.outcome which will have a value of "canceled", "saved", "aborted", or "error" depending on the how the user exited the flow.

A few ideas for how to use the onComplete function:

  • Update your CRM with the results of the flow
  • Retrieve new data from your subscription processor
  • Log out canceled users
  • Update UI elements based on outcome
Did this answer your question?