react-botstar
TypeScript icon, indicating that this package has built-in type declarations

0.7.0 • Public • Published

react-botstar

Easily integrate BotStar widgets into your react application.

Installation

npm i react-botstar

or

yarn add react-botstar

How to use

The botstar widget code is automatically added via a <script> tag at the bottom of the DOM.

To create a botstar widget, just include the component, and set the appId to the Id of your bot. An optional settings object can be provided to set custom settings.

A callback onBotStarInitialised can be set to receive a reference the the BotStarApi function, after the bot has initialised.

import { BotStarWidget } from 'react-botstar';

export const MyBot = (props) => (
  const [botStarApi, setBotStarApi] = useState(null);

  <BotStarWidget
    appId="some-id-here"

    settings={{
      user: {
        email: 'joe@bloggs.com'
      }
    }}
    onBotStarInitialised={ (api) => setBotStarApi(api) } />);

By default, displays the bot in inline mode.

See the BotStar Docs for more information.

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i react-botstar

    Weekly Downloads

    0

    Version

    0.7.0

    License

    Apache-2.0

    Unpacked Size

    14.8 kB

    Total Files

    13

    Last publish

    Collaborators

    • jacobmillward