Skip to main content

Specific script features for the edna.chatCenter channel

Telegram

Attachments for the Telegram channel must originate from an approved domain. Please contact the edna technical support in order to gain access.

Sending images to a chat widget

To send images to the chat widget, specify a file name and extension. For example:

state: Image
q!: image
a: Image
script:
$response.replies = $response.replies || [];
$response.replies.push({
type: "image",
imageUrl: "https://<imageUrl>.jpg",
text: "Image description"
})
caution
You can only attach image and audio files if there is a text message in the above statement.

Sending a file from a script

To send a file from a script, use $response.replies.push with parameters:

state: SendFile
q!: file
a: Send file
script:
$response.replies = $response.replies || [];
$response.replies.push({
type: "file", // Type, can be audio and image
fileUrl: "<https://fileUrl>", // Path
fileName: "example.docx", // Name
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
});
caution
The mimeType parameter is required for file transfer.

Switching the conversation to an agent

To switch the conversation from a bot to an agent, you can use switch, for example:

state: TransferToAgent
q!: switch
script:
$response.replies = $response.replies || [];
$response.replies.push({
type: "switch",
attributes: {
name: "John",
lastName: "Doe",
segmentationInfo: {
product: "deposit"
}
}
});

The segmentationInfo field is used to route clients when switching the conversation to the agent. For example, a bank advises clients on loans and deposits. Let’s assume a client requested a transfer to the agent in order to receive information on deposits.

According to the specified "product": "deposit" segment in segmentationInfo, the search for the corresponding route will be carried out on the side of edna.chatCenter. Then the dialog will be transferred to the agent that is competent in the area of deposits.

caution
The transfer to an agent is only available within the edna.chatCenter channel.

Channel events

When a client sends a message with attached data (graphics, video, document or audio file), fileEvent is sent in the script. A JSON object containing the content type, the link to the file being sent and other metadata are submitted in eventData:

[
{
"url": "https://fileUrl.edna.im/files",
"name": "Screenshot.png",
"type": "image/png",
"size": 340140
}
]