ori-bot-react-native
v0.1.0
Published
Enhance user experience effortlessly by integrating seamless chatbot functionality into your apps using our lightweight npm module. Empower users with interactive conversations and effortlessly integrate AI-powered chatbots into your mobile apps with our
Downloads
4
Readme
ori-bot-react-native
Documentation to integrate and use the Ori Chatbot React naitve SDK (ver. 1.0.0)
Requirements
- React Native >= 0.67.0
- iOS >= 12.0
- Android >= 6.0
Installation
$ npm install ori-bot-react-native @react-native-async-storage/async-storage @react-native-community/netinfo crypto-js react react-native react-native-device-info react-native-get-location react-native-permissions react-native-swipe-gestures react-native-webview
# --- or ---
$ yarn add ori-bot-react-native @react-native-async-storage/async-storage @react-native-community/netinfo crypto-js react react-native react-native-device-info react-native-get-location react-native-permissions react-native-swipe-gestures react-native-webview
Go to the folder your-project/ios and run pod install
, and you're done.
Android post install
For Android you need to define the location permissions on AndroidManifest.xml
.
<!-- Define ACCESS_FINE_LOCATION if you will use enableHighAccuracy=true -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
iOS post install
You need to define the permission NSLocationWhenInUseUsageDescription on Info.plist
.
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs to get your location...</string>
Usage
import OriBotReactNativeView from 'ori-bot-react-native';
import type {
BotDataModelLocal,
BotEventsDataModel,
BotResultDataModel,
} from 'ori-bot-react-native';
// ... your poject code
const chatBotRef = useRef();
<OriBotReactNativeView
ref={chatBotRef}
botId="botId"
onChatEnd={()=>{
console.log("Chat ended")
}}
onBotResult={(res: BotResultDataModel) => {
console.log('onBotResult key :---->', res.key);
console.log('onBotResult value:---->', res.value);
}}
onBotEvents={(data: BotEventsDataModel) => {
console.log('onBotEvents value:----->', data.case);
console.log('onBotEvents type:----->', data.type);
console.log('onBotEvents value:----->', data.value);
}}
config={{
bundleToken: "Your unique Bundle Token",
userObjectToken: "Your unique Object Token"
}}
/>;
Props
ref
(OriBotReactNativeView ref) - Ref to the OriBotReactNativeViewbotId
(String) - Will be provdied by the ORI teamconfig
(Object{bundleToken: string, userObjectToken: string}) - Object will have two keys, will provided by ORI teamonChatEnd
(Function) - callback when the chat session endted form the SDKonBotResult
(Function(BotResultDataModel
)) - callback to receive results data in form of BotResultDataModel objectonBotEvents
(Function(BotEventsDataModel
)) - callback to receive event data in form of BotEventsDataModel object
Methods
clearLocalData
() - method to clear any local data stored in SDK during old sessionsetChatBotData
(BotDataModelLocal) - method to set custom data in the SDK inform of BotDataModelLocal model. For more infomration follow offical ORI SDK documentation
License
MIT
Made with create-react-native-library