Quriobot provides basic Javascript API which you can use to control Quriobot's behavior

Note: as we are actively developing it, new features are added as we go, but we always try to keep backwards compatibility.

If you include widget code in your page, global quriobot object will be available and it has such the methods:

  • quriobot.init(options) - initialize the bot if the explicit intialization was passed via widget URL API so your embed widget code will look like:
    • <script
      defer src="https://quriobot.com/qb/widget/3MY12wr8gmd8AROG/NvRW9mA761E3BgZ4?init=explicit&onScriptLoad=quriobotLoaded">

      this allows you to have full control the moment when bot appears on the screen (event the sticky avatar part). Please note that onScriptLoad parameter is passed, this is a global-scoped callback function which will be called once the quriobot widget script is fully loaded and so quriobot.init can be called

    • options - initialization options which will override those configured via Quriobot Control Room. Important use of it can be the possibility to pass the context to the bot for further use in the API methods. Then custom initialization will look like: 
      • <script
        <script type="text/javascript">
        function quriobotLoaded(){
        context: {
        myContextName: "my context value"

        then you can use context in your script variables like quriobot.options.context.myContextName:

        • function(callback, variables) {

          and even more! QB automatically will prepare api methods for you for all your context values in form of:

          • {%api.qb_myContextName%}

            Note that if your context is a nested object, you can still access the nested values by flattening it using _ separator:

          • {%api.qb_myContextName_nested_value%}

          • You can also override context from the URL using qbprefix and JSON enconding:

            • http://my-qb-page.com?qb.myContextValue="my value"

  • quriobot.start([<bot path>], [language])  - start the bot if it's not set to be autostarted on the page load, if bot path is passed and it's different from previous bot path, the bot will be switched to a new path. Bot path is the last 2 parts of the embed code URL, for example: https://quriobot.com/qb/widget/3MY12wr8gmd8AROG/NvRW9mA761E3BgZ4. language parameter, if passed, will force the bot language. It can have the values described here.
  • quriobot.restart() - store the results for the current chat and restart the chat 
  • quriobot.show_frame()  - show the bot frame if it's not shown
  • quriobot.hide_frame()  - hide the bot frame if it's shown
  • quriobot.destroy() - destroy the bot widget and the frame completely. This is essentially the reverse from quriobot.init. After calling this method, in order to show the bot again, quriobot.init has to be called
  • quriobot.hide() - hides the bot widget completely
  • quriobot.show() - shows the bot widget
  • quriobot.goto(key) - moves the bot conversation directly to the passed step. Step keys can be obtained from the Step settings:


Options object has such properties:

  • language - current bot language
  • autoStart - auto-start timeout
  • autoStartCount - auto start after count
  • restoreState - restore bot state
  • restartAfterClose - restart after close
  • position - bot position
  • positionRtl - bot position for RTL languages
  • preventExitIfIncomplete - prevent bot exit if response is incomplete
  • visitor - visitor ID
  • botOffset: {
    top - bot offset top
    bottom - bot offset bottom
  • stickyAvatarOffset: {
    bottom - sticky avatar offset bottom
  • stickyAvatarPopup: {
    autoShowAfterClosed - auto show sticky avatar popup after bot is closed,

            image - sticky avatar image

  • showStickyAvatar - show sticky avatar, value can be one of: 'always', 'never', 'closed'
  • avatarImage - bot avatar image
  • context - context data
  • showStickyAvatar - 'always' - always show sticky avatar, 'never' - never show, 'closed' - show after first close
  • ga - track bot actions with Google Analytics
  • preload - preload bot prior to actual starting
  • onAnswer - function(results, question, answer) on answer callback
  • onAnswerRedo - function(results, question, answer) - on answer redo callback
  • onExit - function(results) - on exit callback
  • onFinish -function(results) - on finish callback
  • onLeave - function(results) - on leave callback 
  • onRedo - function(results, question, answer) on redo callback
  • onReturn - function(results) - on return callback
  • onValidate - function(results, callback) - on validate callback
  • onSave - function(results, recaptchaResponse, callback) on save callback
  • onLoad - function(data) - on load callback
  • onQuestion - function(results, question) on question callback
  • onStart - function(results) on start callback
  • onInit - function() - on init callback


Friendly & Fun
Interact & Convert