React Native Chat Widget by MSG91 # HelloSDK
Getting started
Login or create account at MSG91 to use Hello SDK service.
After login at MSG91 follow below steps to get your hello chat widget configuration.
- From navigation drawer expand Manage > Inboxes > Select Inbox as Chat > Edit Widget.
- Configure your widget and copy the helloConfig object.
Installing
npm install @msg91comm/react-native-hello-sdk
react-native link
Example
import ChatWidget from 'react-native-hello-sdk';
Create a state to manage the widget visibility and paste the helloConfig object.
const [showWidget, setShowWidget] = useState(false);
var helloConfig = {
widgetToken: "XXXXX",
unique_id: <unique_id>,
name: <name>,
number: <number>,
mail: <mail>
}
Use Component ChatWidget and provide props as shown below.
return (
<View style={{ flex: 1 }}>
<Button title="Chat with us" onPress={()=>setShowWidget(true)} />
<ChatWidget
showWidget={showWidget}
helloConfig={helloConfig}
onCloseWidget={()=>setShowWidget(false)}
/>
</View>
);
License
Copyright 2022 MSG91
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.