🌐
Recrubo API
  • Getting Started
    • Introduction
    • Sandbox
    • Async requests
    • Authentication
    • Webhooks
    • Filtering, sorting, pagination and including resources
  • Guides
    • Setting up webhooks
    • Generating flows
    • Editing flows
    • Triggering flows
    • Embedding the Inbox
    • Sending messages
  • Resources
    • API Resource Reference
      • Candidate
      • Conversation
      • Flow
      • FlowRun
      • FlowGeneration
      • Message
      • MessageTemplate
      • MessageThread
      • NodeAction
      • NodeTransition
      • Node
      • VacancyAnalysis
      • Vacancy
      • User
      • WebhookPayload
    • Embeddables
      • Inbox
      • BotStudio
      • GenerateFlow
      • Whatsapp connect button
      • Schedule Form
      • Schedule Table
    • Flow types
      • vacancy_application_flow
  • Management
    • Organizations
Powered by GitBook
On this page
  • UI
  • Enter basic information
  • Select Pre defined questions
  • Select AI generated skills
  • Generating flow
  • Configuration Settings
  • Initialize
  • Events
  • FlowGenerated
  1. Resources
  2. Embeddables

GenerateFlow

PreviousBotStudioNextWhatsapp connect button

Last updated 6 months ago

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

Setting
Type
Description
Default

vacancyId

string

Id of a vacancy as presented in recrubo

null

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',
            }
        }
    }

    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

Key
Type
Description

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

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>"
        }
        */
    }
})

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 on best practices.

documentation