Skip to content

Overview

Prismeai allows you to interact and display the dialogbox on demand

In window scope, a prismeai namespace is now available. It publish a function action:

Action API

Toggle dialogbox

prismeai.action({ type: 'toggle', value: true })

will open the dialogbox

prismeai.action({ type: 'toggle', value: false })

will close the dialogbox

Push text in dialogbox

prismeai.action({ type: 'text', value: 'Some text message' })

will send 'Some text message' in chatbox like if user have typed himself.

Push event in dialogbox

prismeai.action({ type: 'event', value: {
    text: 'Some text message',
    event: 'Event name
  }
})
will send an event to the chatbox.

Listening to Dialogbox events

Clicks on elements

prismeai.on('click', callback)

will fire when the user click on an element of the interface. The event has multiple properties :

Message

This object is defined if a chat message was clicked. It has the following properties: - type: can be button, event, link, or linkInText. The latter is used for a link in a text message. - text: Clickable element's text, or the whole message's text content if a linkInText. - value: the url if it is a link or linkInText. The target event if an event, or the text to trigger if a button - fromFAQ: Is 'true' if the element was in a FAQ's panel, 'false' otherwise. Unavailable for 'linkInText' elements.

FAQ

The faq object is defined if the click was from the FAQ page. Its properties are :

  • intentName: name of the intent.
  • question: disambiguation sentence.
  • responseText: The first text message of this intent.
  • response: The elements displayed in the panel when the FAQ element was clicked.

Action

This value can be: - stopSpeaking: When the voice recording stop - stopRecording: On native app, when the voice recording stop - voiceRecognition: On native app, when the voice recording start

Message received by user

prismeai.on('messageReceived', callback)

This event contains the message object including the following properties:

  • botName: name of the bot
  • confidence: the NLU's confidence
  • intent: the intent's name