0.7.0 • Published 4 years ago
react-botstar v0.7.0
react-botstar
Easily integrate BotStar widgets into your react application.
Installation
npm i react-botstaror
yarn add react-botstarHow 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.