https://github.com/opsway/react-native-clevertap-inbox
React Native wrapper for the Custom App Inbox feature of CleverTap SDK
https://github.com/opsway/react-native-clevertap-inbox
clevertap opsway-opensource react-native sdk
Last synced: 20 days ago
JSON representation
React Native wrapper for the Custom App Inbox feature of CleverTap SDK
- Host: GitHub
- URL: https://github.com/opsway/react-native-clevertap-inbox
- Owner: opsway
- Created: 2019-02-28T19:19:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-07T18:42:50.000Z (over 4 years ago)
- Last Synced: 2026-03-12T13:49:21.654Z (3 months ago)
- Topics: clevertap, opsway-opensource, react-native, sdk
- Language: Objective-C
- Homepage:
- Size: 37.1 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/react-native-clevertap-inbox)
[](https://www.npmjs.com/package/react-native-clevertap-inbox)
# react-native-clevertap-inbox
We support app badge with unread notifications count for iOS, and most of the Android devices.
IMPORTANT! For proper work on iOS you have to install CleverTap-iOS-SDK via Cocoapods.
## Requirements
Follow the [CleverTap iOS Quickstart guide](https://developer.clevertap.com/docs/ios-quickstart-guide#section-option-a-install-using-cocoapods-recommended-) to install CleverTap-iOS-SDK via Cocoapods.
## Getting started
`$ npm install react-native-clevertap-inbox --save`
### Mostly automatic installation
`$ react-native link react-native-clevertap-inbox`
### Manual installation
#### iOS
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `react-native-clevertap-inbox` and add `RNCleverTapInbox.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNCleverTapInbox.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Run your project (`Cmd+R`)<
#### Android
1. Open up `android/app/src/main/java/[...]/MainActivity.java`
- Add `import com.opsway.react.RNCleverTapInboxPackage;` to the imports at the top of the file
- Add `new RNCleverTapInboxPackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-clevertap-inbox'
project(':react-native-clevertap-inbox').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-clevertap-inbox/android')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-clevertap-inbox')
```
## Usage
```javascript
import RNCleverTapInbox from 'react-native-clevertap-inbox';
//Initialize App Inbox
RNCleverTapInbox.initializeInbox();
//Get Inbox Message Count
RNCleverTapInbox.getInboxMessageCount().then(count => {
console.log('All messages count: ', count);
});
//Get Inbox Unread Count
RNCleverTapInbox.getInboxMessageUnreadCount().then(count => {
console.log('Unread messages count: ', count);
});
//Get All messages
RNCleverTapInbox.getAllInboxMessages().then((response: string) => {
const messages = JSON.parse(response);
console.log('All messages: ', messages);
});
//Get only Unread messages
RNCleverTapInbox.getUnreadInboxMessages().then((response: string) => {
const messages = JSON.parse(response);
console.log('All unread messages: ', messages);
});
//Mark all Unread messages as Read
RNCleverTapInbox.markReadAllUnreadInboxMessages().then((success: boolean) => {
success && console.log(`All unread messages marked as read!`);
});
//Mark Message as Read
RNCleverTapInbox.markReadInboxMessage(messageId: string).then((success: boolean) => {
success && console.log(`Message with id ${messageId} marked as read!`);
});
//Delete message from the Inbox
RNCleverTapInbox.deleteInboxMessage(messageId: string).then((success: boolean) => {
success && console.log(`Message with id ${messageId} deleted!`);
});
```