Buraq Help Center
ProductsBook a demo
  • 😃Welcome to Buraq
    • Buraq Basics
  • 🏁Getting Started
    • Building a Chatbot
    • Testing a Chatbot
    • Installation
      • Installation on Website
        • Installation using HTML
        • Installation using Google Tag Manager
      • Installing on Wordpress
      • Installing on SquareSpace
      • Installation on WhatsApp
      • Installation on Facebook
    • Deploying a Chatbot
    • Utility Tools
  • 🟦ACTION BLOCKS
    • Trigger
      • Set values to variables using Trigger
    • Send Message
    • Collect Input
    • Buttons
    • Carousel
    • Calendar
    • Send an Email
    • Condition
    • Image gallery
    • Talk to human
    • Slider
    • Collect file
    • Delay
    • Form
    • Flow
    • Jump
    • Codeblock
      • Dynamic Dialog Generator
    • Options
    • List
    • Reply buttons
    • AI model
    • Dynamic data
  • 🤖AI Studio
    • Overview
      • From URL
      • From File
      • From Intent
  • 🔌INTEGRATIONS
    • Overview
    • Events
    • HTTP request
    • Javascript
    • Zapier
    • Google Sheets
    • Salesforce
    • Codeblock
    • Airtable
    • Google Calendar
    • Calendly
    • HubSpot
    • Freshdesk
    • DialogFlow
    • Zoho CRM
    • Slack
      • Live Chat for Slack
      • Notification for Slack
    • ActiveCampaign
    • Link Tracking
  • 📲Whatsapp Business API
    • Overview
    • Cost
    • Limitations
    • Getting a WhatsApp API
      • From Meta
        • Creating a Facebook App
        • Adding the phone number
        • Generating permanent token
        • Configuring the webhook on Buraq
  • 💬Live Chat
    • Overview
      • Live Chat Screen
      • Live Chat Settings
  • ⚒️Troubleshooting
    • Cloning Bots
    • Connecting Action Blocks
    • Creating Loops
    • Setting up Fallback Variables
    • Setting up Link Tracking
    • Variable Manager
    • Image Dimensions
    • Tracking Facebook Pixel
    • Firing events on Google Analytics
  • ⛔Outbound Bots
    • Overview
    • Building One Off Campaign
    • Building Ongoing Campaign
    • Creating a WhatsApp Template
    • Action Blocks_ Outbound
      • Send WhatsApp
      • Send SMS
      • Delay
      • Branch
  • 🦾CHATBOT CUSTOMIZATION
    • Chatbot Appearance
    • Custom CSS
    • Embed chatbots on website
    • JS functions to show_hide
  • 🕵️‍♂️Account Management
    • Teams
    • Teammates
    • Purchasing a plan
    • Payment Methods
    • Refund Policy
    • Reset Password
    • Deleting Account
  • 📊Reporting
    • Analytics Dashboard
      • Chatbot Analytics
      • Agent Analytics
    • What are contacts in Buraq?
      • Scheduling a Contact Report
      • Exporting a Contact List
Powered by GitBook
On this page
  • Buttons
  • Carousel
  • List (for WhatsApp)
  • Options (for WhatsApp)
  • Reply Buttons (for WhatsApp)
  1. ACTION BLOCKS
  2. Codeblock

Dynamic Dialog Generator

With the help of dialogGenerator function, we can generate static dialog or dynamic dialog

(Using Service Call Dialog API response variable) in the form of Buttons, Carousal, List, Options and Reply Buttons.

Code-block function name: dialogGenerator

{
  "type": "type_of_dialog",
  "data_variable": "API_response_variable_name",
  "properties": {
    "goal": "optional static",
    "title": "static/path",
    "button_properties": [
      {
        "title": "static/path",
        "type": "static",
        "web_url": "static/path (Optional)",
        "browser_window": "static/path (Optional)"
      }
    ]
  },
  "variable": {
    "name": "variable_name",
    "type": "contact/non_contact"
  }
}

Property of requested arguments

Argument
Description

type

this property refers to the type of dialog you need to generate like a button, carousel, etc.

data_variable

If you want to generate dialogs from JSON data(LikeService Call Dialog API response) this is a mapping of the variable that internally generates dialogs from that variable values(If any).

properties

This refers to particular dialog properties that every dialog uniquely contains.

goal

This property is used for goal tracking in the system. This is an optional property.

title

It refers to the title of the dialog. This is a required property.

button_properties

This property is used to configure the buttons generated by each dialog.

variable

This property is used to store selected response in a variable and it also defines the type of variable(Like contact or non_contact)(Note: This will only work if the variable is already defined in bot-flow)

Buttons

Buttons (with Branch)

{
  "type": "button",
  "data_variable": "API_response_variable_name",
  "properties": {
    "goal": "Button dialog 1",
    "title": "This is button dialog",
    "button_properties": [
      {
        "title": "Button 1",
        "type": "branch"
      },
      {
        "title": "Button 2",
        "type": "branch"
      }
    ]
  },
  "variable": {
    "name": "variable_name",
    "type": "non_contact"
  }
}
  • Here to generate a simple button so we need to set the “type“ property to “button“

  • We have given other necessary properties to code-block arguments. And as we need to generate a static button we specified the “type” property in “button_properties“ as “branch” and gave the name of the button as the title in “button_properties“

  • We have set the variable name as “variable_name“ and the type of variable as “non_contact“

  • We can print the value of the variable “variable_name“ in the next dialog using #variable_name#

  • From the above-requested arguments, the code--block function will generate two buttons.

Note - you need to insert inline JSON in the code-block argument.

Buttons (with URL)

Example arguments

{
  "type": "button",
  "data_variable": "API_response_variable_name",
  "properties": {
    "goal": "Button dialog 1",
    "title": "This is button dialog",
    "button_properties": [
      {
        "title": "Button 1",
        "type": "web_url",
        "web_url": "https://www.google.com",
        "browser_window": "same"
      },
      {
        "title": "Button 2",
        "type": "web_url",
        "web_url": "https://mail.google.com",
        "browser_window": "same"
      }
    ]
  },
  "variable": {
    "name": "variable_name",
    "type": "non_contact"
  }
}
  • Here to create dynamic URL buttons we need to set the type of button as “web_url“

  • Also, there will be two more properties for the web_url button named “web_url“ and “browser_window“

  • The “web_url“ property will set the redirection URL on the button on which the user will click and it will redirect to that URL

  • “browser_window“ is used to set the new redirected URL will open in the “same” window or in the “new” window. The value of this property will be from “same“ or “new“

Example argument

{
  "type": "button",
  "data_variable": "data",
  "properties": {
    "goal": "Button dialog 1",
    "title": "This is button dialog",
    "button_properties": [
      {
        "title": "result[*].title",
        "type": "web_url",
        "web_url": "result[*].avatar",
        "browser_window": "same"
      }
    ]
  },
  "variable": {
    "name": "variable_name",
    "type": "non_contact"
  }
}
  • To generate dialogs dynamically we need to give a path to a particular level and also need to provide variables to generate dynamic dialogs

  • I have used service call dialog to get data variable which is used to generate dynamic buttons

  • Here I have generated web buttons using dynamic data from API responses from the service call dialog

URL buttons generated from API example

{
  "type": "button",
  "data_variable": "data",
  "properties": {
    "goal": "Button dialog 1",
    "title": "This is button dialog",
    "button_properties": [
      {
        "title": "result[*].title",
        "type": "web_url",
        "web_url": "result[*].avatar",
        "browser_window": "same"
      }
    ]
  },
  "variable": {
    "name": "variable_name",
    "type": "non_contact"
  }
}
  • To generate dialogs dynamically we need to give a path to a particular level and also need to provide variables to generate dynamic dialogs

  • I have used service call dialog to get data variable which is used to generate dynamic buttons

  • Here I have generated web buttons using dynamic data from API responses from the service call dialog

Carousel

Static Carousel

{
  "type": "carousel",
  "data_variable": "data",
  "properties": {
    "goal": "this is goal",
    "title": "this is Carousel",
    "card_properties": [
      {
        "image": "",
        "description": "This is carousel card",
        "title": "Card 1",
        "button_properties": [
          {
            "button_type": "branch",
            "title": "Button 1"
          }
        ]
      },
      {
        "image": "",
        "description": "This is carousel card 2",
        "title": "Card 1",
        "button_properties": [
          {
            "button_type": "branch",
            "title": "Button 2"
          }
        ]
      }
    ]
  },
  "variable": {
    "name": "carousel",
    "type": "non_contact"
  }
}
  • This is a simple carousel dialog generated by static data

  • There will be two things that can be dynamically generated, those are cards and buttons in cards

  • Card properties will generate cards for the carousel

  • Button properties situated inside card properties will generate buttons for particular cards

  • “title“ property at a particular object level will generate the title of that particular thing(ie. title inside card properties will be set title for the card and same for button properties)

Static Carousel example

{
  "type": "carousel",
  "data_variable": "data",
  "properties": {
    "goal": "this is goal",
    "title": "this is Carousel",
    "card_properties": [
      {
        "image": "https://reqres.in/img/faces/1-image.jpg",
        "description": "This is carousel card",
        "title": "Card 1",
        "button_properties": [
          {
            "button_type": "branch",
            "title": "Button 1"
          }
        ]
      },
      {
        "image": "https://Buraq-conversation-attachment-staging.storage.googleapis.com/1399_9970_pLVhnmQyTDVr1044216969216TMjJYfU_attachment.png",
        "description": "This is carousel card 2",
        "title": "Card 1",
        "button_properties": [
          {
            "button_type": "branch",
            "title": "Button 2"
          }
        ]
      }
    ]
  },
  "variable": {
    "name": "carousel",
    "type": "non_contact"
  }
}
  • The image carousel will be the same as a simple carousel but the difference will be of image URL

  • If you specify the image URL then it will generate a carousel with the image otherwise not

Dynamic Carousels

Dynamic carousels example

{
  "type": "carousel",
  "data_variable": "data",
  "properties": {
    "goal": "this is goal",
    "title": "this is Carousel",
    "card_properties": [
      {
        "image": "",
        "description": "result[*].description",
        "title": "result[*].title",
        "button_properties": [
          {
            "button_type": "branch",
            "title": "result[*].first_name"
          }
        ]
      }
    ]
  },
  "variable": {
    "name": "carousel",
    "type": "non_contact"
  }
}
  • To generate dynamic cards from variables you need to provide the path as we have done in buttons in form of a look-up path for JSON

  • You can also provide a path to description and image to generate dynamic Cards and buttons as we do it for the title of cards and buttons in the carousel

List (for WhatsApp)

  • We also can generate a list dialog using this code block for WhatsApp only

  • We need to give the type as a list and provide other properties of the list

  • Here section_title refers to the section in the list, it is handled on the WhatsApp side to categorise buttons in one section

  • Buttons having the same section name will fall under one section

Dynamically Generated list Example

{
  "type": "list",
  "data_variable": "data",
  "properties": {
    "goal": "This is Goal",
    "body": "This is List body",
    "list_title": "This is list",
    "button_properties": [
      {
        "section_title": "Buttons",
        "title": "result[*].title",
        "description": "result[*].description"
      }
    ],
    "footer": "This is footer",
    "header": "This is header",
    "error_message": "Please select valid button"
  },
  "variable": {
    "name": "list",
    "type": "non_contact"
  }
}
  • To generate dynamic buttons using variables we need to specify the lookup path for the JSON to the title and description

Options (for WhatsApp)

Static Options example

{
  "type": "button",
  "data_variable": "API_response_variable_name",
  "properties": {
    "goal": "Button dialog 1",
    "title": "This is button dialog",
    "button_properties": [
      {
        "title": "Button 1",
        "type": "branch"
      },
      {
        "title": "Button 2",
        "type": "branch"
      }
    ]
  },
  "variable": {
    "name": "variable_name",
    "type": "non_contact"
  }
}
  • The options dialog is similar to the button dialog on the web, but it is available to generate buttons for WhatsApp only

  • Here button type is also the same as buttons for web channels just difference is that it can not generate web buttons as compared to web channels as WhatsApp does not provide support for web buttons

Dynamically generated Option example

{
  "type": "button",
  "data_variable": "data",
  "properties": {
    "goal": "Button dialog 1",
    "title": "This is button dialog",
    "button_properties": [
      {
        "title": "result[*].title",
        "type": "branch"
      }
    ]
  },
  "variable": {
    "name": "options",
    "type": "non_contact"
  }
}
  • To generate options dialog from variable we need to give a lookup path for JSON to the title property

Reply Buttons (for WhatsApp)

Static Reply Buttons example

{
  "type": "reply_button",
  "variable_name": "any",
  "properties": {
    "goal": "optional static",
    "title": "This is the Reply Button section",
    "button_properties": [
      {
        "button_type": "branch",
        "title": "Reply button 1"
      },
      {
        "button_type": "branch",
        "title": "Reply button 2"
      }
    ],
    "header": {
      "type": "text",
      "text": "This is a reply button header"
    },
    "footer": "This is reply button footer",
    "error_message": "Please select from the above buttons only"
  },
  "variable": {
    "name": "reply_button",
    "type": "non_contact"
  }
}
  • Reply buttons are only available on the WhatsApp channels

  • It provides the same functionality as the reply button in WhatsApp, you can provide the functionality to attach different headers available on the WhatsApp side

  • We can also insert a footer and error message in the reply button dialog

Dynamically Generated Reply Buttons Example

{
  "type": "reply_button",
  "data_variable": "data",
  "properties": {
    "goal": "optional static",
    "title": "This is the Reply Button section",
    "button_properties": [
      {
        "button_type": "branch",
        "title": "result[*].title"
      }
    ],
    "header": {
      "type": "text",
      "text": "This is a reply button header"
    },
    "footer": "This is reply button footer",
    "error_message": "Please select from the above buttons only"
  },
  "variable": {
    "name": "reply_button",
    "type": "non_contact"
  }
}
  • To generate reply button from variable response one need to provide look up path for JSON to the title property. Other properties are static so we can not set path to other property

PreviousCodeblock NextOptions

Last updated 1 year ago

The value of the path of the variable which is generating dynamic buttons needs to be set according to the that is globally defined for JSON

The value of the path of the variable which is generating dynamic buttons needs to be set according to the that is globally defined for JSON

🟦
lookup path
lookup path