GithubHelp home page GithubHelp logo

cognigy / webchatplugins Goto Github PK

View Code? Open in Web Editor NEW
10.0 11.0 16.0 32.3 MB

A collection of example plugins for the Cognigy Webchat as well as a developer guide to write your own plugins.

License: MIT License

JavaScript 77.87% TypeScript 16.86% CSS 3.30% HTML 1.97%
cognigy extensions plugins webchat

webchatplugins's Introduction

Cognigy Webchat Plugins

This repository contains example plugins for the Cognigy Webchat. Additionally, it contains a guide to get you started for plugin development.

Introduction

This guide will help getting you started building cognigy webchat plugins. While this page is focused primarily on basic concepts, you may want to jump in and build a plugin, see some explanatory examples or dive into the API reference.

Plugin Concepts

Display Types

Inline Message

By default, messages will get rendered inline, with an avatar next to it, aligned to the side of the message origin.

Inline Message

Input

If one needs to provide specific input text fields, the input plugin can be used. With this type, various input features can be implemented -- such as an auto-complete field.

Input

Fullscreen Message

Message plugins can utilize a 'fullscreen' mechanism that will render it fullscreen, filling out all the viewport of the webchat. This can be used to create dialog-like mechanics where the user's attention can be locked onto the next step.

Fullscreen Message

Fullwidth Message

When displaying content that needs space and is not directly percieved as a message (such as images, event notifications, qr codes), a plugin can be configured to be displayed fullwidth, without an avatar, alignment and padding.

Fullwidth Message

Plugins as Middlewares

For every message, the webchat decides how to render it by iterating over all the registered message plugins. Every plugin contains a mechanism that can decide whether it matches a message or not. If a plugin matches a message, the webchat will stop iterating and use that plugin to render the message.

In the examples below, we have a total of five webchat plugins. The webchat iterates through each plugin from left to right until it finds a match. Outlined circles represent plugins that did not match, dark circles represent matched plugins, light circles represent plugins that were not taken into consideration.

Plugin Message

If no matching custom plugin was found, the webchat will fall back to its default message plugin (the last one).

Default Message

When a message is matched by a custom plugin that has the 'passthrough' option enabled, the webchat will render the message with that plugin and then continue iterating, making multiple outputs for a single message possible.

Passthrough Plugin Message

webchatplugins's People

Contributors

alexteusz avatar cabullmann avatar cbuchwald avatar cesarcs7 avatar dependabot[bot] avatar dereinepete avatar dshire avatar ebibergall avatar kwinto avatar mastasky avatar mayrbenjamin92 avatar miriamschroeder avatar pedily avatar uzlopak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webchatplugins's Issues

package.json -> 'main' is not correct

I believe the location listed under main in your package.json is incorrect. It is listed as "index.jsx", but should be listed as "src/index.jsx". This error was noted in the process to upload to Cognigy. After making this update I could upload to Cognigy without errors.

rating: should not submit empty values

ss

Possible solution: the Send Rating button can be disabled before the user enters any rating. Or we can allow the user to explicitly avoid entering any rating by e.g. adding a "Skip" button.

Map not loading

Hi,

After adding the map plugin only pointer is displaying, background map is not displaying.

Multiselect: the number of options to select and message bubble

I have a few ideas on improving Multiselect:

  1. A message bubble is always shown above the Open Button even if the message is null or empty text. It doesn't look good when it is empty, I suggest to simply hide it.
  2. It would be very practical if the number of options, which the user can/must select, can be specified. E.g. selectAtLeast, selectAtMost. Now the user can select none or select all options.
  3. After the user had used the select and the flow moved on, the user can open the select again and submit one more time. I suggest disabling the button to avoid this.
  4. It would be nice to see the value(s) selected as a message from the user, similarly to how Rating does it.

Also, README.md can be improved by adding a real-life example of a message, e.g.:

const payload = {
    _plugin: {
        type: 'multiselect',
        allowUserAnswers: false,
        cancelButtonLabel: 'Cancel',
        inputPlaceholder: 'Enter Time',
        options: ['10:00', '10:30', '11:00', '11:45', '12:15'],
        openButtonLabel: 'Choose Time',
        submitButtonLabel: 'Submit'
    }
}
api.say('Select Time', payload)

GoogleMaps

problem google maps plugin

problem 2

The Google Maps Plugin isn't working properly in my google chrome webbrowser.

Google Chrome version: 84.0.4147.105 (Offizieller Build) (64-Bit)

What could be my issue?

Rating: Webchat dies when variant=emoji and precision=0.5

When the aforementioned combo is selected in the message payload, then the browser console shows this error and the whole webchat breaks (empty page).

Possible solution: in case of out-of-range values for the given variant, fall back to the nearest value that makes sense. E.g. consider precision=1 even when the message has precision=0.5

webchat.legacy.js:279 TypeError: Cannot read property 'label' of undefined
    at getLabelText (rating.webchat-plugin.js:966)
    at he (rating.webchat-plugin.js:379)
    at rating.webchat-plugin.js:379
    at Array.map (<anonymous>)
    at rating.webchat-plugin.js:379
    at Array.map (<anonymous>)
    at rating.webchat-plugin.js:379
    at da (webchat.legacy.js:279)
    at Ua (webchat.legacy.js:279)
    at Ts (webchat.legacy.js:279)
ps @ webchat.legacy.js:279
Ls.n.callback @ webchat.legacy.js:279
ki @ webchat.legacy.js:279
wi @ webchat.legacy.js:279
wu @ webchat.legacy.js:279
t.unstable_runWithPriority @ webchat.legacy.js:287
Jo @ webchat.legacy.js:279
vu @ webchat.legacy.js:279
su @ webchat.legacy.js:279
(anonymous) @ webchat.legacy.js:279
t.unstable_runWithPriority @ webchat.legacy.js:287
Jo @ webchat.legacy.js:279
Xo @ webchat.legacy.js:279
$o @ webchat.legacy.js:279
nu @ webchat.legacy.js:279
enqueueSetState @ webchat.legacy.js:279
w.setState @ webchat.legacy.js:271
(anonymous) @ webchat.legacy.js:322
b @ webchat.legacy.js:6
(anonymous) @ webchat.legacy.js:322
(anonymous) @ webchat.legacy.js:322
(anonymous) @ webchat.legacy.js:322
(anonymous) @ webchat.legacy.js:322
(anonymous) @ webchat.legacy.js:322
(anonymous) @ webchat.legacy.js:322
(anonymous) @ webchat.legacy.js:322
u.emit @ webchat.legacy.js:6
(anonymous) @ webchat.legacy.js:263
r.emit @ webchat.legacy.js:263
m.onevent @ webchat.legacy.js:263
m.onpacket @ webchat.legacy.js:263
(anonymous) @ webchat.legacy.js:263
r.emit @ webchat.legacy.js:263
m.ondecoded @ webchat.legacy.js:263
(anonymous) @ webchat.legacy.js:263
r.emit @ webchat.legacy.js:320
f.add @ webchat.legacy.js:6
m.ondata @ webchat.legacy.js:263
(anonymous) @ webchat.legacy.js:263
r.emit @ webchat.legacy.js:6
f.onPacket @ webchat.legacy.js:320
(anonymous) @ webchat.legacy.js:320
r.emit @ webchat.legacy.js:6
i.onPacket @ webchat.legacy.js:6
i.onData @ webchat.legacy.js:6
ws.onmessage @ webchat.legacy.js:322
Show 16 more frames
webchat.legacy.js:279 Uncaught TypeError: Cannot read property 'label' of undefined
    at getLabelText (rating.webchat-plugin.js:966)
    at he (rating.webchat-plugin.js:379)
    at rating.webchat-plugin.js:379
    at Array.map (<anonymous>)
    at rating.webchat-plugin.js:379
    at Array.map (<anonymous>)
    at rating.webchat-plugin.js:379
    at da (webchat.legacy.js:279)
    at Ua (webchat.legacy.js:279)
    at Ts (webchat.legacy.js:279)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.