GenerateFlow
The Generate Flow component allows a user to easily generate a flow for the vacancy provided. This is a 3 step process:
Basic information
Flow title
Language
Emoji usage
Predefined questions
Ai generated questions
UI
Enter basic information

Select Pre defined questions
Recrubo Defaults

Ats Fields
soon to come
Select AI generated skills

Generating flow

Configuration Settings
vacancyId
string
Id of a vacancy as presented in recrubo
null
scheduleMode
string
Schedule mode for appointment steps. Options: 'multi' or 'custom'
'multi'
scheduleIdPath
string
Path for schedule ID when scheduleMode is 'custom'. Only used when scheduleMode='custom'
'schedule_id'
Initialize
To load the Generate Flow component in an iframe you set the source attribute to https://api.recrubo.app/public/v2/embed/component/generate-flow
, once the iframe is loaded you use postMessage
to send an initialize event including the vacancyId
in the settings property.
Example
<iframe id="generateFlowFrame" src="https://api.recrubo.app/public/v2/embed/component/generate-flow"></iframe>
<script type="text/javascript">
const generateFlow = document.querySelector('#generateFlowFrame')
generateFlow.onload = (evt) => {
const generateFlowSettings = {
action: 'initialize',
token: 'XX-XX-XX-XX-XX',
settings: {
generateFlow: {
vacancyId: 'xxxxx-xxxxxx-xxxxxx-xxxxx',
scheduleMode: 'custom', // Optional: 'multi' or 'custom'
scheduleIdPath: 'schedule_id' // Optional: only used when scheduleMode is 'custom'
}
}
}
generateFlow.contentWindow.postMessage(generateFlowSettings, 'https://recrubo.app')
}
</script>
Events
FlowGenerated
When the flow is generated and the user clicks the 'finish' button the following event payload will be posted back to your application.
This is event is purely for interface purposes, you should configure a webhook to be sent whenever a flow is created and act based on that information. This event is not guaranteed to trigger since a user could close the window at any moment
flowName
string
Name of the generated flow
vacancyId
string
Id of the vacancy used to generate the flow
flowId
string
Id of the flow that has been generated
This event listener does not only execute when Recrubo posts a message. Any other, potentially malicious, website could use this to try and access your application. Ensure that your code only allows Recrubo and other trusted origins to execute behaviour within this event-handler. See documentation on best practices.
window.addEventListener('message', (event) => {
// validate the event originates from Recrubo
if (event.origin !== 'https://recrubo.app') {
throw new Error(`Untrusted event origin: ${event.origin}`)
}
if (event.data.component === "generateFlow" && event.data.event === "flowGenerated") {
/* These are the remaining keys in event.data
{
"flowName": "Name of your generated flow",
"vacancyId": "<id of your vacancy>",
"flowId": "<id of the generated flow>"
}
*/
}
})
Last updated