0.1.1 • Published 4 years ago

lmfr-openlab-angular-chatbot-module v0.1.1

Weekly downloads
401
License
-
Repository
-
Last release
4 years ago

Lmfr-Openlab-Angular-Chatbot-Module

Integrate library into angular application

Install firebase dependency required by the module

npm i firebase --save
npm i ngx-cookie --save 
npm i @nguniversal/express-engine --save 
npm install @agm/core --save 
ng add @angular/material 

In app.module.ts :

import {LmfrOpenlabAngularChatbotModule} from 'lmfr-openlab-angular-chatbot-module';

Bot initlization data

const chatbotConfig = {
name: 'Bot api name ',
displayName: 'Bot display name',
token: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
expression: 'first expression', // To wake up the bot
apiUrl: 'https://api.cai.tools.sap/build/v1/dialog' ,
clientApiKey: 'PUBLIC_LMFR_API_KEY'
//Si Dialogflow => fournir l'url de l'instance lmfr-openlab-support-client-chatbot-backend/df/detect
type: 'recast' // ou bien 'dialogflow',
project: 'id du project DF' ,
firebaseConfig : fbConfig ,
shouldShowSummaryPannel: shouldShowSummaryPannelOption,
errorMessageText: 'Arf ... Je ne sais pas quoi répondre'

};

Optional config for vote tracking on firebase

const fb = {
apiKey: '.............................',
authDomain: '.........................',
databaseURL: '.....................',
projectId: '...................',
storageBucket: '................',
messagingSenderId: '...........',
appId: '..................................'
};

Configuation of the summary pannel

const shouldShowSummaryPannelOption = false  // default value is true ;
imports: [
...,
LmfrOpenlabAngularChatbotModule.forRoot(chatbotConfig), 
  
...
]

In footer componant html file : <lib-lmfr-openlab-angular-chatbot-module></lib-lmfr-openlab-angular-chatbot-module> OR

<lib-lmfr-openlab-angular-chatbot-module <br>
(activateBotEvent)="onActivateBotEvent()" (hideBotEvent)="onhideBotEvent()"<br>
(resetBotEvent)="onResetBotEvent()" (rateThumbUpEvent)="onRateThumbUpEvent()"<br>
(rateThumbDownEvent)="onRateThumbDownEvent()"<br>
(userSentMessageEvent)="onUserSentMessageEvent($event)"<br>
(botRespondedEvent)="onBotRespondedEvent($event)"></lib-lmfr-openlab-angular-chatbot-module>;

Events triggerged :

onActivateBotEvent() {} 

onhideBotEvent() {} 

onResetBotEvent() {} 

onRateThumbUpEvent() {} 

onRateThumbDownEvent() {}

onUserSentMessageEvent(messsage: Message[]) {}

onBotRespondedEvent(messsage: Message[]) {}

Summary panel:

A panel containing summary on what the bot can do . To use it , set shouldShowSummaryPannel = true ; create intention in your agent "get-resume" that responde with a custom payload :

<head>
...
<link href="assets/lmfr-openlab-angular-chatbot-module.css" rel="stylesheet">
</head>

if summary feat is used edit css to make it pretty

IAdvize

Intercept "botRespondedEvent" and call method onBotRespondedEvent:

onBotRespondedEvent(messsage: Message[]) {
if (messsage.length > 0) {
      if (messsage[messsage.length - 1].intent === 'talk.human') {
        console.log('calling iadvize');
        try {
          // @ts-ignore
          window.idzCustomData = messsage;
          // @ts-ignore
          tc.event();
        } catch (e) {
          console.log('error invok iadvize');
          console.log(e);
        }
      }
    }
}

Acces to library functions

Here is an example on how to activate and hide the bot without clic on icon:

if (LmfrOpenlabAngularChatbotComponent.instance.botService.bot.isMinimised) {
   LmfrOpenlabAngularChatbotComponent.instance.onActivateClick();
} else {
   LmfrOpenlabAngularChatbotComponent.instance.onCloseClick();
}
0.1.1

4 years ago

0.1.0

4 years ago

0.0.98

4 years ago

0.0.99

4 years ago

0.0.97

4 years ago

0.0.96

4 years ago

0.0.95

4 years ago

0.0.94

4 years ago

0.0.93

4 years ago

0.0.91

4 years ago

0.0.90

4 years ago

0.0.89

4 years ago

0.0.88

4 years ago

0.0.84

4 years ago

0.0.85

4 years ago

0.0.86

4 years ago

0.0.87

4 years ago

0.0.80

4 years ago

0.0.81

4 years ago

0.0.82

4 years ago

0.0.83

4 years ago

0.0.73

4 years ago

0.0.74

4 years ago

0.0.75

4 years ago

0.0.76

4 years ago

0.0.77

4 years ago

0.0.78

4 years ago

0.0.79

4 years ago

0.0.72

4 years ago

0.0.70

4 years ago

0.0.71

4 years ago

0.0.68

4 years ago

0.0.69

4 years ago

0.0.67

4 years ago

0.0.66

4 years ago

0.0.65

4 years ago

0.0.64

4 years ago

0.0.63

4 years ago

0.0.62

4 years ago

0.0.61

4 years ago

0.0.60

4 years ago

0.0.59

4 years ago

0.0.58

4 years ago

0.0.57

4 years ago

0.0.56

4 years ago

0.0.54

4 years ago

0.0.55

4 years ago

0.0.53

4 years ago

0.0.51

4 years ago

0.0.52

4 years ago

0.0.50

4 years ago

0.0.49

4 years ago

0.0.48

4 years ago

0.0.47

4 years ago

0.0.45

4 years ago

0.0.46

4 years ago

0.0.44

4 years ago

0.0.43

4 years ago

0.0.42

4 years ago

0.0.41

4 years ago

0.0.40

4 years ago

0.0.39

4 years ago

0.0.38

4 years ago

0.0.37

4 years ago

0.0.36

4 years ago

0.0.35

4 years ago

0.0.33

4 years ago

0.0.34

4 years ago

0.0.32

4 years ago

0.0.31

4 years ago

0.0.30

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.21

4 years ago

0.0.22

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.25

4 years ago

0.0.26

4 years ago

0.0.27

4 years ago

0.0.20

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.19

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago