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 (outcome) {
        return new Promise(function (resolve, reject) {
            // example: retrieve new data and update UI
        });                
    }
}

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?