
Description
This Node displays HTML content in the Agent Copilot workspace. You can design custom layouts to present information to a human agent. HTML content may include text, images, videos, links, and scripts. The Set HTML Tile Node is useful for displaying complex information. Technically, the HTML content will be injected into an iFrame on the workspace side, so any general restrictions on iFrames also apply to this case.Parameters
Parameter | Type | Description |
---|---|---|
Tile ID | CognigyScript | The ID that you created in the Agent Copilot configuration. |
HTML Content | HTML | The HTML content to render inside the Widget. |
JSON Data | JSON | The data to send to the IFrame as a postMessage event. |
Using React or Angular
In the Copilot: HTML Tile Node, you can enhance your HTML content by utilizing the React or Angular libraries. These libraries allow you to seamlessly display dynamic widgets within your workspace. To use these libraries in the Copilot: HTML Tile Node, you need to include them in your HTML code.Example
Example
Receiving JSON Data from the Flow
When you use a Copilot: HTML Tile, JSON data is passed into the HTML code using the postMessage method. To receive and process the passed JSON in your widget, add an event listener into the Copilot: HTML Tile Node and handle the data accordingly.Sending JSON Data back to the Flow
You can send data back to the Flow by using the Postback feature.Postback
Postback
The Postback feature allows you
to send data either back to the Flow or chat, or directly to the widget interface.
This feature can be useful for updating the state of your widget based on human agent interactions.
These interactions can include actions such as submitting forms,
updating display elements, or notifying the system of changes made by the human agent.The Postback feature can be configured in the following ways:
Using SDK.postback
Follow these steps to implement postback for your widget:- Add the
SDK.postback
function to the HTML page. Make sure this code is included after the SDK script is loaded:
- Send a String
- Send an Object
- Click the button in the widget in the Agent Copilot workspace. Triggering this action will send an injected message formatted as follows:
{{ input.data._cognigy._agentAssist }}
to the Text field in the Say Node of your Agent Copilot Flow.
This Node should be placed below the Node with the SDK.postback
function.
The output will be available in the chat message and visible only to human agents.Example
In this example, theSDK.postback
function sends the value of name
back to the user.
If name
is falsy, meaning the user did not enter a name, the else
block is executed, and the function calls setMessage('Please enter your name.');
.
This message will appear in the widget, prompting the user to provide their name and reminding them of the required input.