Skip to main content
The Execution Finished Transformer converts the Flow output after a Flow execution has finished. The return value of the execution finished transformer is sent to the Endpoint. This transformer applies only to REST-based Endpoints using the output transformer. You can configure the execution finished transformer in the handleExecutionFinished function in the Endpoint settings or via CLI.

Transformer Function Arguments

The following table shows an overview of the function arguments:
ArgumentDescription
endpointThe configuration object for the Endpoint.
outputsThe outputs array from the output transformer. This array contains the Flow outputs.
processedOutputThe Flow output processed into the format that the Endpoint expects.
userIdThe unique ID of the user.
sessionIdThe unique ID of the session.

Endpoint Configuration Object

PropertyTypeDescription
_idstringThe Endpoint’s Reference ID.
channelstringThe Endpoint’s channel.
URLTokenstringThe URL Token, found in the Input object.
namestringThe Endpoint’s name.
flowIdstringThe Reference ID of the specified Flow to which the Endpoint points to.
entrypointstringThe Entrypoint of the Endpoint.
activebooleanThe flag to activate or deactivate the Endpoint.
nluConnectorIdstringID of the selected NLU connector for the Endpoint.
useAnalyticsbooleanThe flag to collect analytics data for the Endpoint.
storeDataPayloadbooleanThe flag to store data payloads into analytics for the Endpoint.
useConversationsbooleanThe flag to collect conversations history for the Endpoint.
maskIPAddressbooleanThe flag to mask sensitive IP addresses in input object and analytics data.
maskAnalyticsbooleanThe flag to mask sensitive data in analytics for the Endpoint.
maskLoggingbooleanThe flag to mask sensitive data in logs for the Endpoint.
useContactProfilesbooleanThe flag to use Contact Profiles for the Endpoint.
useDashbotAnalyticsbooleanThe flag to use Dashbot for collecting analytics data.
dashbotApikeystringThe API key of the Dashbot bot for analytics collection.
dashbotPlatformstringThe selected platform of the Dashbot bot for analytics collection.
settingsobjectOptional Endpoint-specific settings. For example, Facebook Page token.
handoverSettingsobjectSettings to configure a handover provider.
createdAtnumberUnix timestamp when the Endpoint was created.
lastChangednumberUnix timestamp when the Endpoint was last modified.
createdBystringEmail of the user who created the Endpoint.
lastChangedBystringEmail of the user who last modified the Endpoint.

Return Values

The return value of the execution finished transformer depends on the Endpoint type you are using. There is no validation of the execution finished transformer return value. If the execution finished transformer returns a falsy value, the output isn’t sent to the Endpoint. The execution finished transformer takes the outputs array from the output transformer and sends it to the Endpoint. For example, if you’re using the execution finished transformer in an Alexa Endpoint, the return value format must meet the Alexa message format. Here is an example of the correct return format for an Alexa Endpoint:
handleExecutionFinished: async ({ processedOutput, outputs, userId, sessionId, endpoint, response }) => {

    const text = outputs.reduce((processedOutput, output) => `${processedOutput}. ${output.text}`, "").trim();

    const responseToAlexa = {
        version: "1.0",
        response: {
            outputSpeech: {
                type: "SSML",
                ssml: `<speak>${text}</speak>`
            },
            shouldEndSession: false
        }
    };

    return responseToAlexa;
}
I