Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webchat Integration #18

Open
wants to merge 191 commits into
base: main
Choose a base branch
from
Open

Webchat Integration #18

wants to merge 191 commits into from

Conversation

rockwellll
Copy link
Collaborator

This PR introduces a new set of classes and modules that allow the integration of WebChats to be used via the JS client.

Configuration

It adds a new WebChat configuration in core/configuration/web_chat that allow to set (or override) values of the WebChat, the API for initializing a WebChat looks like this,

Hellotext.initialize('PUBLIC_BUSINESS_ID', {
  webChat: {
    id,
    container,
    placement,
    classes,
    triggerClasses,
    style: {
      background,
      foreground,
      typography
    },
    behaviour,
  }
})

Read more on the docs https://github.com/hellotext/hellotext.js/blob/webchat/docs/webchat.md.

WebSockets

It introduces a parent application_channel that is used to establish WebSocket connections to Hellotext. And, it adds a web_chat_channel that inherits from it and subscribes to WS for webchat channel, which includes messages sent from the Inbox, and conversation assignment state changes.

subscribe() {
const params = {
channel: "WebChatChannel",
id: this.id,
session: this.session
}
this.send( { command: 'subscribe', identifier: params })
}

Controllers

Then, the webchat controller hooks into these and does something on each event,

this.webChatChannel.onMessage(this.onMessageReceived)
this.webChatChannel.onConversationAssignment(this.onConversationAssignment)
this.webChatChannel.onAgentOnline(this.onAgentOnline)

  • It supports pagination
  • It has an attachment tool
  • It has an emoji tool

Mixins

It extracts a usePopover mixin that is used by both the WebChat and the Emoji tool to display a dropdown popover listing their content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants