Chatlayer Documentation
Get in touchAbout Chatlayer
  • Welcome
  • What's new
  • Send feedback
  • start quickly
    • Leadzy tutorial
      • 0. Introduction
      • 1. New bot, new block
      • 2. Understand your users
      • 3. Collect and display user input
      • 4. Steer the conversation with Conditions
      • 5. Empower your bot with Actions
      • 6. Set up a channel and publish your bot
    • Templates
      • Banking
      • E-Commerce Returns
      • E-Bike Shop
      • E-Scooter Support
      • Feedback
      • Find Nearest Location
      • GPT
      • 🆕Gym
      • Job applications
      • Knowledge base AI template
      • Lead generation
      • 🆕NPS
      • Restaurant
      • Retail
  • navigation
    • Analytics
      • Dashboard
      • Customers
      • Conversations
      • User flow
      • Intents
      • 🆕Funnels [Beta]
    • Bot builder
      • Flows
        • Canvas functionalities
        • Collaborate with team members
        • Manage your flows
        • 🆕[Beta] Export and import flows
      • Bot dialogs view
      • Translations
      • Events
    • NLP
      • Dashboard
      • Intents
      • Expressions
      • Entities
      • Train
      • NLP settings
      • Improve
    • Knowledge base AI
      • Add content to your KBAI
      • Build your KBAI flow
      • Use your KBAI source URL in a button
      • Use tags to limit your KBAI content
      • 🆕Use Tables to store your KBAI questions
      • 🆕Manage handover where KBAI is unsatisfactory
    • History
      • Conversations
      • Execution logs
      • Versions
    • Channels
    • Tables
      • Create a table with records
      • Column types
      • Operate on your records
        • Insert record
        • Update record
        • Retrieve record
        • Delete record
      • API
    • Settings
      • Bot settings
      • Offloading
      • Variables
      • Voice
      • Import/Export
  • build your bot
    • Conversation design
      • Plan your bot
      • Conversation design workflow
    • Flow logic
      • Blocks
        • Message
        • Condition
        • Collect input
        • Action
      • Go-to connections
    • 🆕Emulator
    • Tips & best practices
      • Route your flow depending on the time
      • Improve the Not understood block
        • How to create better not understood messages
        • Not understood counter
        • Not understood Google search
      • Go to previous block
      • Recognizing a returning user
      • Skip introduction message
      • Route your flow depending on the channel
      • Reuse flows
      • Connect two bots to each other
  • understand users
    • Natural language processing (NLP)
      • Basic NLP concepts
      • Detect information with entities
        • Match entities
        • Contextual entities
        • System entities
        • Composite entities
      • NLP best practices
        • Word order and diversity of expressions
      • AI intent booster
      • Train your NLP
      • Context
      • NLP import & export
      • Sentiment analysis
    • Languages
      • Supported languages
      • Make your bot multilingual
      • Change language within the conversation
  • set up channels
    • Add a channel to your bot
    • All channels
      • 🚨Facebook Messenger [Deprecated soon]
        • Facebook Admin Removal
        • Facebook Webview Whitelisting
        • Facebook Messenger API updates for Europe
      • 🚨Google Assistant [Deprecated soon]
      • Webhook
      • Web
        • 🚨Web V1 [Deprecated]
          • Customize web widget
          • Live example web widget
        • 🆕Web V2
          • 🆕From Web V1 to V2
          • 🆕Web V2 methods and options
    • Sinch Conversation API
      • Configure your Sinch Conversation API
      • 🆕 Make the most of RCS with Carousels
      • WhatsApp Business API
  • integrate & code
    • API calls
      • Configure your API integration
      • Advanced API features
      • V1 API Reference
      • Custom integrations 101
    • Code editor
      • [Example] Sending data to Airtable (POST)
      • [Example] Retrieving data from Airtable (GET)
      • [Example] Making SOAP requests
    • App integrations
      • Airtable
      • Freshdesk
      • Freshdesk Messaging
      • 🆕Gmail
      • Intercom
      • Mailgun
      • OpenAI: GPT-3, ChatGPT and GPT-4
      • Salesforce
      • 🆕Slack
      • Topdesk
      • Zendesk Support
      • Zendesk Sunshine (beta)
    • 🆕Expression syntax
    • Human handover & live chat
      • Sinch Contact Pro
      • #Interact
      • Genesys Cloud
      • Offloading Webhook
      • Salesforce Service Cloud
      • Sparkcentral by Hootsuite
      • Zendesk Chat
    • Chatlayer messages specifications
  • Publish
    • Publish your bot
      • Publish a flow
  • Analyze & maintain
    • Analytics definitions
    • Data retention
    • Maintenance
    • Session
    • Track events for analytics
  • VOICE
    • 🆕Send bot response as audio
    • Voicebots
      • Create a voicebot
      • Voicebot-specific actions
      • Test your voicebot
      • From chat to voice
  • access & support
    • Identity & Access
      • Single Sign-On (SAML SSO)
    • Billing & subscription
    • Get in touch
    • Chatlayer glossary
    • SaaS Regions & IP Ranges
    • Status
    • Debug your bot
      • No correct response
      • Collect input not working
      • Video isn't working
Powered by GitBook
On this page
  • Coding steps
  • Code
  • API
  • JSON builder
  • Pausing steps
  • Pause bot
  • Delay
  • Variables steps
  • Clear session
  • Set variables
  • Go to variable bot dialog
  • Email steps
  • Send mail
  • Mail report
  • Voicebot steps
  • Start recording the call
  • Stop recording the call
  • Forward call
  • Other steps
  • Track event
  • iFrame
  • Get time
  • Close conversation
  • Table operation
  • Knowledge base AI
  • Send to offload provider

Was this helpful?

  1. build your bot
  2. Flow logic
  3. Blocks

Action

Action blocks are where 3rd-party, coding logic or special operations can be added to your bot.

PreviousCollect inputNextGo-to connections

Last updated 5 months ago

Was this helpful?

From 1st October 2024, all Chatlayer customers will be migrated to the new web widget, Web V2. To learn more about the differences between V1 and V2, check For a technical deep dive, check .

You can use the JSON builder in combination with the to receive on your webpage. These events will contain the data as configured in your JSON builder action.

To do this, you'll need to tick the Send config to parent window option. It will allow you to send data to the place where the widget is in a structured way.

Here's an example:

  1. Configure your JSON builder action to send a language key, with a variable retrieved from the session.

  2. Set the toggle Send config to parent window on.

Action blocks allow you to integrate third-party services, implement custom coding logic, or perform specialized operations within your bot

Coding steps

Code

The code editor allows developers to quickly build custom logic on top of the bot by writing their own Javascript code blocks. Typically, the code editor is used to perform requests to external systems, or to do operations with variables.

You can find more information about the code editor here:

There are also two tutorials in which we show you how the code editor can be used:

API

JSON builder

Website window events

You can use the JSON builder action in combination with the webwidget channel to receive window events on your webpage. These events will contain the data as configured in your JSON builder action.

Here's an example: Configure your JSON builder action to send a language key, with a variable retrieved from the session, and the "Send config to parent window" toggled on.

Your widget will trigger an event for that configuration to its parent window as a MessageEvent. The MessageEvent will contain a `data` field which contains the stringified result of the JSON builder configuration. Here's an example on how to listen to these events:

// Chatlayer JSON Builder Event Handler
window.addEventListener('message', (event) => {
    const data = event && event.data && JSON.parse(event.data) || {}
    const { type, payload } = data
    if (type !== 'CL_DISPATCH_EVENT') return;
    console.log('Chatlayer language received: ' + payload.language)
})

Pausing steps

Pause bot

The Pause bot step will pause your bot when it reaches this block.

Delay

Sometimes you need a slight delay between bot messages, either to create a natural pause or to make an API call without the bot being silent. These pauses can significantly enhance the user experience.

Variables steps

Clear session

Set variables

Operations allow you to perform calculations like addition, subtraction, multiplication, division, or finding the remainder of two numbers.

Go to variable bot dialog

Use the Go to variable bot dialog step to navigate to a block that is contained inside a variable.

Email steps

Send mail

The Send mail step sends an email with a message.

Mail report

The Mail report step sends 2 things:

  • an email with a message

  • the bot conversation at the time where the message was send

All you need to do is to define the email title, recipients and body. Here you can also use variables between curly braces if you need to.

Voicebot steps

Start recording the call

Stop recording the call

Forward call

The phone number should contain a country code but no leading zeros, only the '+' sign. For example: 0800 55 800 becomes +32 800 55 80

After setting up the phone number you wish to forward your call to, the bot will automatically hang up upon transferring. To reach the bot again, hang up the call and call a second time.

Other steps

Track event

iFrame

Have a look at this basic example:

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		</head>
		<body>
			<button onClick="window.parent.postMessage(JSON.stringify({target:'CL_API',type:'SEND_MESSAGE', payload:{text: 'You clicked the button'} }),'*')">
         SEND_MESSAGE
        </button>
		</body>
</html>

If this block of code is hosted and embedded within our iframe plugin, it will send the user a chat message when they click the button.

The postMessage API can also handle UPDATE_SESSION and GO_TO_DIALOGSTATE events.

Get time

When you provide a timezone offset, the result of the plugin will contain time properties that are equal to UTC+offset.

Get time variables

If you do not provide a time zone offset, the current moment in time will be saved under the Target variable field. In our example, this variable will be called time. In this case, your Target variable will be accessible with the following variables:

  • (target).utc.year

  • (target).utc.month

  • (target).utc.dayOfMonth

  • (target).utc.dayOfWeek

  • (target).utc.hours

  • (target).utc.minutes

  • (target).utc.seconds

  • (target).utc.ISO

By default, the plugin result will contain properties related to the UTC time.

When you provide a timezone offset, the result will also contain time properties that are equal to UTC+<OFFSET>.

  • (target).offset.year

  • (target).offset.month

  • (target).offset.dayOfMonth

  • (target).offset.dayOfWeek

  • (target).offset.hours

  • (target).offset.minutes

  • (target).offset.seconds

  • (target).offset.ISO

Inside a message, you can use those variables for instance like this:

Today is {time.offset.dayOfMonth}/{time.offset.month}/{time.offset.year}

Close conversation

The bot will close the active conversation when the Close conversation step is reached.

This means that the session variables are erased.

Example: Delay before Close conversation

Table operation

Knowledge base AI

Send to offload provider

A user that reaches this action will be offloaded to a human customer support agent.

Depending on your selected offloading provider, additional configuration may be required.

Add an Action block by to your flow.

The is an integration where you integrate Chatlayer with your back end or third party services in order to share data gathered in the conversation with the bot, or enrich the bot with data captured.

If your bot is published on the channel, you can use the JSON Builder action to send messages to the conversation that don't need to result in an actual message to the user. Typically, it's used to send information about the user or bot conversation to the website the bot is published on.

You can step.

Use a Clear session step to clear out that you don't need anymore.

The Set variable step facilitates the creation, formatting, and assignment of values to .

We've recently introduced a . To explore the full range of expressions and functions available, check out the comprehensive documentation provided .

For a comprehensive list of available operations such as addition (+), multiplication (*), division (/), and more, please refer to the detailed documentation provided .

From the Start recording the call step, the .

From the Stop recording the call step, the conversation with your will stop being recorded.

You can by using the Forward call step.

A Track event step can be used you to .

An iFrame is a custom element that can be used to show a different web page in the chat conversation. It can also be used to communicate with the parent window using the .

The is about guiding your flow based on the current moment in time. You can reuse those inside your conversation.

You can for example use the Close conversation step together with a step. This is useful in a situation where the user is not responding for a few minutes and you want to close the conversation from there.

Close conversation is now available on the channel, channel, and channel.

The Table operation step is about using your built-in Chatlayer .

The Knowledge base AI step is about using your .

To be able to see this step in your bot, you will need to

dragging and dropping it
Code editor
[Example] Retrieving data from Airtable (GET)
[Example] Sending data to Airtable (POST)
API step
Webhook API
variables
variables
new expression syntax
here
here
conversation with your voicebot is being recorded
voicebot
forward the call from your voicebot to a phone number
create custom dashboards and funnels to improve the analysis of your bot performance
postMessage API
Route your flow depending on the time
Web
Voice
Sinch Conversation API
Tables
configure an offload provider.
for example use Delay before a Close conversation
Get time step
time variables
Delay
Knowledge base AI
this page.
this page
Web channel
window events
JSON builder step.
JSON builder with a language field.
Action tab.
Example of an Action block.
API step.
JSON builder action with a language field
Pause bot step.
Delay step.
Clear out variables inside a Clear session step.
Add an operation inside your variable value.
Go to variable bot dialog step.
Send mail step.
Mail report step.
Start recording the call step.
Stop recording the call step.
Forward call step.
Track event step.
Get time step.
Close conversations step.
Table operation step
Knowledge base AI step.