This site is no longer updated.Go to new Conversational Cloud docs

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.push( {
                type: "image",
                imageUrl: "https://<imageUrl>.jpg",
                text: "image.jpg"              // image file name and extension
            } )

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:

    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 to the file
            fileName: "example.docx",            // name of the file
            mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
        });

The mimeType parameter is required for file transfer.


Switching the conversation to an operator

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

    state: switch
        q!: switch
        script:
            $response.replies = $response.replies || [];
            $response.replies.push({
                type:"switch",
                closeChatPhrases: ["/closeLiveChat", "Close chat"],
                firstMessage: $client.history,
                lastMessage: "We’ll be waiting for your return!",
                attributes: {
                "Name": "John",
                "Last Name": "Doe"
                }
            });

Channel events

When a client sends a message with attached data (graphics, video, document or audio file), event: 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.threads.im/files",
      "name":"Screenshot.png",
      "type":"image/png",
      "size":340140
   }
]

Learn more about the fileEvent event processing

Please note the events common for all channels