3.5.8 • Published 7 months ago

botfactory-conversation v3.5.8

Weekly downloads
4
License
ISC
Repository
-
Last release
7 months ago

BotFactory conversation

Component to interact with Bot Factory bots from Senior X Platform.

This component is started in any website, you only need to create a HTML element and paste de script bellow changing the variables. If needed, change de optional params.

Use as a lib (NPM)

Currently, to use as library format you need a Font Awesome 5 Pro license added to your project.

In this format you will always need to manually update this package on your project. In the package.json file, add ~ before the version number to auto-increment that inside of the same major. Eg.: ~3.0.2

Install the production dependency: npm i botfactory-conversation

Add in your HTML:

Use any identifier.

<div id="botfactory-container"></div>

Typescript

import { BotFactoryConversation } from 'botfactory-conversation'

const config = {
  appKey: '1at2b34ka56-789012-4616-141515fsa-fb3a315k277f7b',
  element: document.getElementById('botfactory-container'),
  restUrl: 'https://platform.senior.com.br/t/senior.com.br/bridge/1.0/anonymous/rest/'
}
const BotFactory = (<any>window).BotFactory as BotFactoryConversation
BotFactory.init(config)

Javascript

Example in ES7 syntax. To ES5 use require()

import { BotFactoryConversation } from 'botfactory-conversation'

const config = {
  appKey: '1at2b34ka56-789012-4616-141515fsa-fb3a315k277f7b',
  element: document.getElementById('botfactory-container'),
  restUrl: 'https://platform.senior.com.br/t/senior.com.br/bridge/1.0/anonymous/rest/'
}
const BotFactory = (<any>window).BotFactory
BotFactory.init(config)

Use from CDN

<script>
  ;(function (d, s, id) {
    var js,
      fjs = d.getElementsByTagName(s)[0]
    if (d.getElementById(id)) {
      return
    }
    js = d.createElement(s)
    js.id = id
    js.src =
      'https://cdn.tecnologia.senior.com.br/platform/botfactory/conversation/production/bundle.js'
    fjs.parentNode.insertBefore(js, fjs)
  })(document, 'script', 'botfactory-sdk')
  ;(function () {
    window.onload = function () {
      window.BotFactory.init({
        appKey: '1at2b34ka56-789012-4616-141515fsa-fb3a315k277f7b',
        restUrl: 'https://platform.senior.com.br/t/senior.com.br/bridge/1.0/anonymous/rest/',
        autoOpen: true
      })
    }
  })()
</script>

Development

To generate and make available a production bundle (bundle.js), use the following commands:

webpack
node server.js

API

Lifecycle methods

MethodDescriptionDeclaration
initStarts the conversation componentinit(config, callback?): void
destroyClose and destroy conversation component componentdestroy(): void

init()

Pass some properties to the conversation component on your page. Inside the script tag, use:

  window.BotFactory.init({
    appKey: 'your-app-key',
    autoOpen: true,
    width: 500,
    height: 900
    ...
  });
PropertyTypeRequiredDefault valueDescription
appKeyStringYesundefinedRepresents the key from the bot service.
restUrlStringYeshttps://platform.senior.com.br/t/senior.com.br/bridge/1.0/anonymous/rest/Environment address to use services. Even if there's a fallback value (padrão), it's fundamental to supply that.
usernameStringNoundefinedA value to identify the user who talks to the bot.
autoOpenBooleanNofalseIf true, does the conversation box auto open and starts the conversation
mode'user' | 'monitor' | 'readonly'NouserToggle between conversation modes: conversation or monitoring (Monitoring mode is only available to administrators.
developmentBooleanNofalseWhen in development mode, allow termination conversation with a bot, otherwise, it's only available to minimize de conversation box.
widthNumberNo400Measures in pixels which indicate the width from conversation box.
heightNumberNo600Measures in pixels which indicate the height from conversation box.
fullScreenBooleanNofalseConversation box in full-screen mode.
showFullScreenButtonBooleanNotrueAllow users to toggle between full-screen mode or window.
3.5.8

7 months ago

3.5.7

10 months ago

3.5.3

1 year ago

3.5.2

1 year ago

3.5.1

1 year ago

3.5.6

1 year ago

3.5.5

1 year ago

3.5.4

1 year ago

3.5.0

2 years ago

3.4.0

2 years ago

3.4.1

2 years ago

3.3.3

2 years ago

3.3.2

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.3

3 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.2.0

4 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.41

5 years ago

1.0.40

5 years ago

1.0.39

6 years ago

1.0.38

6 years ago

1.0.37

6 years ago

1.0.36

6 years ago

1.0.35

6 years ago

1.0.34

6 years ago

1.0.33

6 years ago

1.0.32

6 years ago

1.0.31

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago