Chat Embed is an easy way to include the full chat functionality. This includes functionalities like uploading and downloading attachments.
Calling the chat endpoint on GroupChat and Aux GroupChat resources will output a URL that can be used in an IFrame.
<iframe src="[chat-embed-url]" id="chat-iframe" referrerpolicy="strict-origin-when-cross-origin"></iframe>
The generated URL from the endpoint has extra host domain validation and a separate Application Client ID with domain whitelist is required for this to work. Please contact Support for more information.
It is possible to more deeply integrate the chat embed with the host page by including the following script: https://api.alterdesk.com/public/js/chat-embed-helper.min.js
This script contains the ChatEmbed
Helper Class which can be used as follows:
<script src="https://api.alterdesk.com/public/js/chat-embed-helper.min.js"></script>
<script type="text/javascript">
var iframe = document.getElementById('chat-iframe');
var chatEmbed = new ChatEmbed(iframe);
chatEmbed.on('video-call-join', function() {
// Retrieve videoEmbed URL from backend and open in another iframe
});
</script>
Create a new instance of the ChatEmbed Helper class.
Name | Type | Description |
iframe | Inline Frame | Handle to the Chat Embed iframe. |
The ChatEmbed Helper is an EventEmitter where you can subscribe on the events defined below.
Add a listener for the specified event.
Name | Type | Description |
eventName | String | Event from the table below. |
function | Function | Callback to trigger when the event is emitted. |
Event | Argument | Description |
started | The chat has setup and is now available. | |
video-call-join | The user has clicked on button to join video call. |
Change the status of the user.
Name | Type | Description |
status | String | New status of the user. Available options: online, dnd, away, offline |