Expo SDK Module for DigitalGenius Chat.
For managed Expo projects, please follow the installation instructions in the API documentation for the latest stable release. If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
For React Native projects, you must ensure that you have installed and configured the expo
package before continuing.
npm install genius-chat-expo
Run npx pod-install
after installing the npm package.
No additional setup necessary.
export default function App() {
DGChatModule.showDGChatView(
"your_widget_id",
"your_environment",
{}, //optional custom configs
"crm_platform", // optional
"crm_version", // optional
);
return (
<View style={styles.container}>
<Text>Hello</Text>
</View>
);
}
You can use config to customise your chat widget style. Eg: floating button position, proactive buttons. We reccommend that you work with your DigitalGenius Solution Engineer to apply custom configurations. See the configuration docs for more details:
configs = {
proactiveButtonsSettings: {
isEnabled: true,
questions: ["A", "B", "C"],
answers: ["X", "Y", "Z"]
},
generalSettings: {
isChatLauncherEnabled: true
},
}
DGChatModule.showDGChatView(
"your_widget_id",
"your_environment",
configs, //ooptional custom configs
"crm_platform", // optional
"crm_version", // optional
);
You can use a set of additional methods to interact directly with Chat Widget. These methods are lised as a part of DGChatModule
.
The sendMessage
method allows the customer to programmatically send a message on the user's behalf. This method is not available once the user is handed over to a crm:
function sendMessage(message: string)
The sendSystemMessage method allows the customer to programmatically send a system message. This method is only available after the chat has been embeded:
function sendSystemMessage(payload: object)
For example:
sendSystemMessage({
"name" : "auth_token",
"payload" : "your_jwt_token",
})
The launchWidget
method allows the customer to programmatically launch the widget:
function launchWidget()
The initProactiveButtons
method allows the customer to programmatically trigger the proactive buttons to display:
function initProactiveButtons(questions: Array<string>, answers: Array<string>)
The hideDGChatView
method allows customer to hide the chat view:
function hideDGChatView()
See full methods list for more details.