react-native-messaging-zendesk
v0.1.5
Published
test
Downloads
72
Readme
react-native-messaging-zendesk
react-native module for Zendes Messaging
based on the native SDKs guide for Zendesk messaging
See the Android integration guide
See the IOS integration guide
Installation
npm install react-native-messaging-zendesk
add zendesk maven repo to android/build.gradle and change compileSdkVersion to 33
// ...
buildscript {
ext {
compileSdkVersion = 33
// ...
allprojects {
repositories {
// ...
maven {
url "https://zendesk.jfrog.io/artifactory/repo"
}
}
}
add zendesk messaging dependecy to android/app/build.gradle
dependencies {
// ...
implementation "zendesk.messaging:messaging-android:2.8.0"
}
Usage
- initialize SDK
import { initSdk } from 'react-native-messaging-zendesk';
// ...
initSdk({
android: '< ANDROID_CHAT_CHANNEL_ID >',
ios: '< IOS_CHAT_CHANNEL_ID >',
});
- open the chat Screen
import { showMessaging } from 'react-native-messaging-zendesk';
// ...
showMessaging();
- authenticated Access
See the Enabling authenticated visitors for messaging with Zendesk SDKs
import { loginUser, logoutUser } from 'react-native-messaging-zendesk';
// ...
// login User
loginUser('< BACKEND_GENERATED_JWT_TOKEN >');
// logout User
logoutUser();
- get messages count
import { subscribe, unsubscribe } from 'react-native-messaging-zendesk';
// ...
// subscribe to unreadMessageCountChanged
subscribe('unreadMessageCountChanged', (messagesCount) => {
// do stuff with unreadMessageCountChanged
});
// dont forget to unsubscribe
React.useEffect(() => {
return () => {
unsubscribe('unreadMessageCountChanged');
};
}, []);
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library