Action
Action blocks are where 3rd-party, coding logic or special operations can be added to your bot.
Last updated
Action blocks are where 3rd-party, coding logic or special operations can be added to your bot.
Last updated
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:
Configure your JSON builder action to send a language key, with a variable retrieved from the session.
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
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:
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:
The Pause bot step will pause your bot when it reaches this block.
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.
Operations allow you to perform calculations like addition, subtraction, multiplication, division, or finding the remainder of two numbers.
Use the Go to variable bot dialog step to navigate to a block that is contained inside a variable.
The Send mail step sends an email with a message.
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.
Have a look at this basic example:
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.
When you provide a timezone offset, the result of the plugin will contain time properties that are equal to UTC+offset
.
The bot will close the active conversation when the Close conversation step is reached.
This means that the session variables are erased.
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