Introduction
Docebo Flow allows you to open an instance of your Docebo platform in any external web platform, as long as you have access to its HTML and Javascript code.
This article gives details on the specific commands used to interact with the Docebo Flow app launcher.
Lifecycle commands
setTokenProvider(callback)
Provides the app launcher a function to invoke when the current access token expires. The provided function must return a Promise that resolves with the new access token.
This command uses the following parameter:
callback
(required): a function that provides a new access token
Example:
function renewToken(){
// an HTTP call to your backend-to-backend login process
}
DFlow.setTokenProvider(renewToken);
start(domain, [code], [token])
This command starts the app launcher.
This command uses the following parameters:
domain
(string, required): The domain of the Docebo platform (this can be also a custom domain)code
(string, optional): The unique code assigned to the app launcher (if any)token
(string, optional): The access token to perform authenticated calls to the Docebo platform
The command returns a promise that resolves when the app launcher has fully started and loaded. This makes the parent page to become aware of the status of the launcher which allows for the triggering of events based on that information.
The start command promise resolves only after the launcher is ready to be shown. This gives you the ability to use this feature to open the launcher automatically or, for example, perform searches behind the scenes prior to displaying the results.
Example:
DFlow.start(“customer.docebosaas.com”, “Launcher123”,”access_token”)
.then(() => console.log(‘Launcher running’));
By default when the app launcher is first started, it will display the icon only with the popup in a closed state (see the Interaction commands section; the default state after start()
visually appears as if the commands show()
and close()
were issued together).
(In case of Custom Button usage the opening the logic remains the same but the Icon will not be shown)
shutdown()
This command stops and removes the app launcher from the screen. Returns a promise that resolves when the app launcher has been terminated.
Example:
DFlow.shutdown()
.then(() => console.log(‘Launcher stopped’));
restart(domain, [code], [token])
This command is a commodity method that stops the app launcher and starts it again. It is a simplified version of invoking the shutdown followed by the start commands.
This command uses the following parameters:
domain
(string, required): The domain of the Docebo platform (this can be also a custom domain)code
(string, optional): The unique code assigned to the launcher (if any)token
(string, optional): The access token to perform authenticated calls to the Docebo platform
Returns a promise that resolves when the app launcher has fully started again.
Example:
DFlow.restart(“customer.docebosaas.com”, “Launcher123”)
.then(() => console.log(‘Launcher successfully restarted’));
Interaction commands
show()
This command shows the app launcher icon and popup (if the popup is in a visible state - see open()
).
Example:
DFlow.show();
hide()
This command hides the app launcher (both the icon and the popup).
Example:
DFlow.hide();
open()
This command opens the app launcher popup. If the app launcher has been hidden via the hide()
command, then the popup will be visible when the show()
command is invoked. This command has no effect on the app launcher icon.
Example:
DFlow.open();
close()
This command closes the app launcher popup. If the app launcher has been hidden via the hide()
command, then the popup will not be visible when the show()
command is invoked. This command has no effect on the app launcher icon.
Example:
DFlow.close();
togglePopup()
Opens the app launcher popup if it is closed and vice versa. If the app launcher has been hidden by the hide()
command, then the effect will not be visible until the show()
command is invoked.
Example:
DFlow.togglePopup();