Static ReadonlyATTR_Access type for opening the conversation.
Defaults to ConversationAccessType.NORMAL if not set.
Static ReadonlyATTR_ID of the conversation to open in the component
Static ReadonlySLOT_Name of the slot used to provide custom content displayed when no conversation is open.
If the slot has no content, Unblu displays the standard loader instead.
The access type for opening the conversation. Defaults to ConversationAccessType.NORMAL if not set.
Note: When setting both conversationId and accessType, changes are batched and applied together in a single update
to avoid unnecessary reconnections. For explicit control, use openConversation instead.
The access type for the conversation
UnbluConversationElement.ATTR_ACCESS_TYPE to set this as an attribute
The Conversation API object for the currently open conversation.
Returns null if no conversation is open or the agent JS API isn't initialized yet.
The returned instance is destroyed and replaced when the open conversation or the access type changes.
The ID of the conversation to display.
This can be set before Unblu is initialized. The conversation is then opened as soon as Unblu is initialized.
If the conversation doesn't exist, or the user doesn't have permission to access it, a dialog is displayed with the appropriate error message.
In such cases, the conversation ID is reset to null.
Note: When setting both conversationId and accessType, changes are batched and applied together in a single update
to avoid unnecessary reconnections. For explicit control, use openConversation instead.
The id of the conversation to open
UnbluConversationElement.ATTR_CONVERSATION_ID to set this as an attribute
Registers for the UnbluConversationElement.CONVERSATION_CHANGED event
Optionaloptions: boolean | AddEventListenerOptionsRegisters for the UnbluConversationElement.ACCESS_TYPE_CHANGED event
Optionaloptions: boolean | AddEventListenerOptionsRegisters for the UnbluConversationElement.MESSAGE_INPUT_AVAILABILITY_CHANGED event
Optionaloptions: boolean | AddEventListenerOptionsCopies the given content (text and/or files) into the message input of the currently open conversation.
The content is inserted into the current state of the message input (by default appended) so the agent can review and edit it before sending.
Files are added to the pending files of the message input; the same validation as for manually selected files applies.
If options.internal is set, the message input is also switched to the internal or public messaging mode.
After copying, the message input receives the focus.
If the message input isn't currently displayed, for example because a call is ongoing, the chat UI is opened automatically so the agent sees the copied content.
Use getMessageInputAvailability to check upfront what content can be copied.
The content to copy and how it is inserted
Optionaloptions: CopyToMessageInputOptionsOptions controlling how the content is copied, for example the messaging mode
Resolves once the content has been copied into the message input
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the Agent Embedded JS API isn't initialized.
UnbluApiError with type UnbluErrorType.INVALID_FUNCTION_ARGUMENTS if the given content or options are invalid.
UnbluApiError if the requested content can't be copied based on the current availability, for example no conversation is open in the element, the agent lacks the permission for the requested messaging mode, or the content contains files while the file upload isn't available.
Returns what content can currently be copied into the message input of the open conversation, based on the conversation permissions of the agent.
All fields are false if no conversation is open in the element, the conversation is displayed as ghost, or the Agent Embedded JS API isn't initialized.
To get notified when the availability changes, listen to the MESSAGE_INPUT_AVAILABILITY_CHANGED event.
The availability of the message input for content copied via copyToMessageInput
Opens a conversation with the given ID and access type.
This is the recommended way to programmatically change the conversation and access type together, as it applies both values in a single update without batching delay.
The method can be called before the Agent Embedded JS API is initialized. The conversation is then opened as soon as Unblu is initialized.
If the conversation doesn't exist, or the user doesn't have permission to access it, a dialog is displayed with the appropriate error message.
In such cases, the conversation ID is reset to null.
The previously opened conversation will be closed and disconnected.
The ID of the conversation to open, or null to close the current conversation without opening another conversation
The access type for the conversation. Defaults to ConversationAccessType.NORMAL
The Conversation API object for the conversation being opened,
or null if conversationId is null or the agent JS API isn't initialized yet
Removes a listener registration for the UnbluConversationElement.CONVERSATION_CHANGED event
Removes a listener registration for the UnbluConversationElement.ACCESS_TYPE_CHANGED event
Removes a listener registration for the UnbluConversationElement.MESSAGE_INPUT_AVAILABILITY_CHANGED event
Static ReadonlyACCESS_Event emitted every time the conversation access type changes.
Static ReadonlyCONVERSATION_Event emitted every time the currently open conversation changes.
Static ReadonlyMESSAGE_Event emitted every time the availability of the message input changes, see getMessageInputAvailability.
This is a custom element which can be used to integrate a single conversation into a webpage at a specific location.
To use the custom element, place a tag named "unblu-conversation" somewhere in the web page's
body.The size and positioning of the element depend entirely on the styles applied to it by the website that it's embedded in. The styling within the web component, on the other hand, aren't affected by the website's styles, because it uses a shadow root for its content. Unblu provides numerous configuration properties that let you customize the web component's appearance to suit your organization's requirements.
The example above only adds the conversation component to the
DOMwithout initializing anything. To initialize and display content, you must create the UnbluAgentEmbeddedApi. Until then, the element doesn't display any content other than content the webpage itself adds inside the tag, which renders as regularDOMchildren.Once the Agent Embedded JS API is initialized and until a conversation is opened, the element displays the content provided via the
no-conversationslot, or the standard loader if the slot has no content.The Unblu UI inside the custom element always fills the whole content of the element irrespective of the size it's given.
Note: You can display any number of UnbluEmbeddedAppElement and UnbluConversationElement components on the same page, with the restriction that a conversation can only be displayed in one of them at a time, regardless of the component type. If a conversation is already displayed in one component, opening it in another component fails: that component shows a message dialog and reverts to its previous view.
Attributes
conversation-id: ID of the conversation to display. See UnbluConversationElement.conversationId.access-type: Access type for the conversation. One ofNORMAL(default) orGHOST. See UnbluConversationElement.accessType.Custom content while no conversation is open
To customize what's displayed while no conversation is open, provide content via the
no-conversationslot. If the slot has no content, Unblu displays the standard loader instead.Programmatic control
To change the conversation and access type together, use the openConversation method. This applies both values atomically without batching delay:
The conversation property gives access to the Conversation API object of the currently open conversation.
When setting both
conversation-idandaccess-typeattributes (or properties) separately, changes are automatically batched within the same microtask to avoid unnecessary reconnections.Events
conversationChangedfires when the displayed conversation changes. See UnbluConversationElement.CONVERSATION_CHANGED.accessTypeChangedfires when the access type changes. See UnbluConversationElement.ACCESS_TYPE_CHANGED.messageInputAvailabilityChangedfires when the availability of the message input changes. See UnbluConversationElement.MESSAGE_INPUT_AVAILABILITY_CHANGED.See
MDN Custom Element
No Inherit Doc