Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 17 Next »

Through the API methods any CTLive integrator can send text messages, link or multimedia content, leave an active chat, terminate a chat for all participant.

Below we list all the available APIs related with a code example. The APIs are related to an istance of active chat, for example the same object returned by calling the joinContact method.

Send a Text message

ctlive_contact.sendMessage("Hello world!").then(
  function (msgid) {
    console.log("Message sent", msgid);
  }
);

Send a Multimedia message

// Send a DOCUMENT type message (doc/docx/xls/xlsx/ppt/pptx/pdf)
ctlive_contact.SendMultimediaMessage( "CHAT_eaa2e7c0-9c26-40db-b720-d777ab68078d", "DOCUMENT", Base64Content).then (
  function (msgid) {
    console.log("Document message sent", msgid);
  }
);

// Send an IMAGE type message (png/jpg/jpeg)
ctlive_contact.SendMultimediaMessage( "CHAT_eaa2e7c0-9c26-40db-b720-d777ab68078d", "IMAGE", Base64Content).then (
  function (msgid) {
    console.log("Image message sent", msgid);
  }
);

Send an Hyperlink message

ctlive_contact.SendLink("https://www.enghouseinteractive.it/").then (
  function (msgid) {
    console.log("Hyperlink message sent", msgid);
  }
);

Notifies “is writing” agent status

// The agent has started writing
ctlive_contact.isWriting(true);

// The agent has stopped writing
ctlive_contact.isWriting(false);

Terminate an active chat

// End a chat and disconnect all participant.
// The first parameter is the instance of a CTLive active chat.
// The second parameter is reserved and assigned to false
LIVECHATSDK.LIVECHAT.endContact(ctlive_contact, false);

Leave an active chat

LIVECHATSDK.LIVECHAT.leave("CHAT_eaa2e7c0-9c26-40db-b720-d777ab68078d");
  • No labels