{"id":29425694,"url":"https://github.com/devrev/devrev-sdk-cordova","last_synced_at":"2026-04-08T20:04:54.553Z","repository":{"id":302421405,"uuid":"994781690","full_name":"devrev/devrev-sdk-cordova","owner":"devrev","description":"DevRev SDK, used for integrating DevRev services into your Cordova app.","archived":false,"fork":false,"pushed_at":"2025-07-25T07:34:20.000Z","size":292,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-25T13:15:24.378Z","etag":null,"topics":["analytics","android","cordova","framework","ios","ipados","java","kotlin","library","mobile","mobile-sdk","objective-c","observability","phonegap","support","swift","typescript"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devrev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-02T13:24:21.000Z","updated_at":"2025-07-25T07:34:25.000Z","dependencies_parsed_at":"2025-07-02T10:22:22.065Z","dependency_job_id":"7dc40544-c8ff-4d41-b1ce-58be6142d946","html_url":"https://github.com/devrev/devrev-sdk-cordova","commit_stats":null,"previous_names":["devrev/devrev-sdk-cordova"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/devrev/devrev-sdk-cordova","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrev%2Fdevrev-sdk-cordova","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrev%2Fdevrev-sdk-cordova/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrev%2Fdevrev-sdk-cordova/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrev%2Fdevrev-sdk-cordova/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devrev","download_url":"https://codeload.github.com/devrev/devrev-sdk-cordova/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrev%2Fdevrev-sdk-cordova/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31571608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","android","cordova","framework","ios","ipados","java","kotlin","library","mobile","mobile-sdk","objective-c","observability","phonegap","support","swift","typescript"],"created_at":"2025-07-12T10:02:09.912Z","updated_at":"2026-04-08T20:04:54.542Z","avatar_url":"https://github.com/devrev.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# DevRev SDK for Cordova\nDevRev SDK, used for integrating DevRev services into your Cordova app.\n\n## Table of contents\n- [DevRev SDK for Cordova](#devrev-sdk-for-cordova)\n  - [Table of contents](#table-of-contents)\n  - [Quickstart guide](#quickstart-guide)\n    - [Requirements](#requirements)\n    - [Installation](#installation)\n    - [Set up the DevRev SDK](#set-up-the-devrev-sdk)\n  - [Features](#features)\n    - [Identification](#identification)\n      - [Anonymous identification](#anonymous-identification)\n      - [Unverified identification](#unverified-identification)\n      - [Verified identification](#verified-identification)\n        - [Generate an AAT](#generate-an-aat)\n        - [Exchange your AAT for a session token](#exchange-your-aat-for-a-session-token)\n        - [Identifying the verified user](#identifying-the-verified-user)\n      - [Updating the user](#updating-the-user)\n      - [Logout](#logout)\n    - [PLuG support chat](#plug-support-chat)\n      - [Creating a new support conversation](#creating-a-new-support-conversation)\n    - [In-app link handling](#in-app-link-handling)\n      - [In-app link callback](#in-app-link-callback)\n    - [Analytics](#analytics)\n    - [Session analytics](#session-analytics)\n      - [Opting-in or out](#opting-in-or-out)\n      - [Session recording](#session-recording)\n      - [Session properties](#session-properties)\n      - [Masking sensitive data](#masking-sensitive-data)\n        - [Example (masked element):](#example-masked-element)\n        - [Example (unmasked element):](#example-unmasked-element)\n      - [Timers](#timers)\n      - [Screen tracking](#screen-tracking)\n      - [Screen transition tracking (Android only)](#screen-transition-tracking-android-only)\n    - [Push notifications](#push-notifications)\n      - [Configuration](#configuration)\n      - [Register for push notifications](#register-for-push-notifications)\n      - [Unregister from push notifications](#unregister-from-push-notifications)\n      - [Processing push notification](#processing-push-notification)\n        - [Android](#android)\n          - [Example](#example)\n        - [iOS](#ios)\n          - [Example](#example-1)\n  - [Sample app](#sample-app)\n  - [Troubleshooting](#troubleshooting)\n  - [Migration guide](#migration-guide)\n\n## Quickstart guide\n### Requirements\n- Cordova 12.0 or later.\n- On Android, the minimum API level should be 24.\n- On iOS, the minimum deployment target should be 15.0.\n\n### Installation\nTo install the DevRev SDK, run the following command:\n\n```sh\ncordova plugin add @devrev/sdk-cordova\n```\n\n### Set up the DevRev SDK\n1. Open the DevRev web app at [https://app.devrev.ai](https://app.devrev.ai) and go to the **Settings** page.\n2. Under **PLuG settings** copy the value under **Your unique App ID**.\n3. After obtaining the credentials, you can configure the DevRev SDK in your app.\n\nThe SDK will be ready for use once you execute the following configuration method.\n\n```javascript\nDevRev.configure(appID, successCallback, errorCallback)\n```\n\n## Features\n### Identification\nTo access certain features of the DevRev SDK, user identification is required.\n\nThe identification function should be placed appropriately in your app after the user logs in. If you have the user information available at app launch, call the function after the `DevRev.configure(appID:)` method.\n\n\u003e [!IMPORTANT]\n\u003e On iOS, if you haven't previously identified the user, the DevRev SDK will automatically create an anonymous user for you immediately after the SDK is configured.\n\n\u003e [!IMPORTANT]\n\u003e The `Identity` structure allows for custom fields in the user, organization, and account traits. These fields must be configured through the DevRev app before they can be used. For more information, refer to [Object customization](https://devrev.ai/docs/product/object-customization).\n\nYou can select from the following methods to identify users within your application:\n\n#### Anonymous identification\nThe anonymous identification method allows you to create an anonymous user with an optional user identifier, ensuring that no other data is stored or associated with the user.\n\n```javascript\nDevRev.identifyAnonymousUser(successCallback, errorCallback)\n```\n\n#### Unverified identification\nThe unverified identification method identifies users with a unique identifier, but it does not verify their identity with the DevRev backend.\n\n```javascript\nDevRev.identifyUnverifiedUser(identity, successCallback, errorCallback)\n```\n\n#### Verified identification\nThe verified identification method is used to identify users with an identifier unique to your system within the DevRev platform. The verification is done through a token exchange process between you and the DevRev backend.\n\nThe steps to identify a verified user are as follows:\n1. Generate an AAT for your system (preferably through your backend).\n2. Exchange your AAT for a session token for each user of your system.\n3. Pass the user identifier and the exchanged session token to the `DevRev.identifyVerifiedUser(userID, sessionToken, successCallback, errorCallback)` method.\n\n\u003e [!CAUTION]\n\u003e For security reasons we **strongly recommend** that the token exchange is executed on your backend to prevent exposing your application access token (AAT).\n\n##### Generate an AAT\n1. Open the DevRev web app at [https://app.devrev.ai](https://app.devrev.ai) and go to the **Settings** page.\n2. Open the **PLuG Tokens** page.\n3. Under the **Application access tokens** panel, click **New token** and copy the token that's displayed.\n\n\u003e [!IMPORTANT]\n\u003e Ensure that you copy the generated application access token, as you cannot view it again.\n\n##### Exchange your AAT for a session token\nIn order to proceed with identifying the user, you need to exchange your AAT for a session token. This step will help you identify a user of your own system within the DevRev platform.\n\nHere is a simple example of an API request to the DevRev backend to exchange your AAT for a session token:\n\u003e [!CAUTION]\n\u003e Make sure that you replace the `\u003cAAT\u003e` and `\u003cYOUR_USER_ID\u003e` with the actual values.\n```bash\ncurl \\\n--location 'https://api.devrev.ai/auth-tokens.create' \\\n--header 'accept: application/json, text/plain, */*' \\\n--header 'content-type: application/json' \\\n--header 'authorization: \u003cAAT\u003e' \\\n--data '{\n  \"rev_info\": {\n    \"user_ref\": \"\u003cYOUR_USER_ID\u003e\"\n  }\n}'\n```\n\nThe response of the API call will contain a session token that you can use with the verified identification method in your app.\n\n\u003e [!NOTE]\n\u003e As a good practice, **your** app should retrieve the exchanged session token from **your** backend at app launch or any relevant app lifecycle event.\n\n##### Identifying the verified user\nPass the user identifier and the exchanged session token to the verified identification method:\n\n```javascript\nDevRev.identifyVerifiedUser(userID, sessionToken, successCallback, errorCallback)\n```\n\n#### Updating the user\nYou can update the user's information using the following method:\n\n```javascript\nDevRev.updateUser(identity, successCallback, errorCallback)\n```\n\n\u003e [!IMPORTANT]\n\u003e The `userID` property cannot be updated.\n\n#### Logout\nYou can logout of the current user by using the following method:\n\n```javascript\nDevRev.logout(deviceID, successCallback, errorCallback)\n```\n\nThe user will be logged out by clearing their credentials, as well as unregistering the device from receiving push notifications, and stopping the session recording.\n\n\n### PLuG support chat\nOnce user identification is complete, you can start using the chat (conversations) dialog supported by our DevRev SDK. The support chat feature can be shown as a modal screen from the top-most screen.\n\n\u003e [!IMPORTANT]\n\u003e This feature requires the SDK to be configured and the user to be identified, whether they are unverified or anonymous.\n\n```javascript\nDevRev.showSupport(successCallback, errorCallback)\n```\n\n#### Creating a new support conversation\nYou can initiate a new support conversation directly from your app. This method displays the support chat screen and simultaneously creates a new conversation.\n\n```javascript\nDevRev.createSupportConversation(isAnimated, successCallback, errorCallback)\n```\n\n### In-app link handling\nIn certain cases, tapping links in the support chat opens them in the app instead of a browser. You can control whether the chat modal screen is dismissed after the link is opened by calling the following method:\n\n```javascript\nDevRevSDK.setShouldDismissModalsOnOpenLink(value, successCallback, errorCallback)\n```\n\nSetting this flag to true applies the system's default behavior for opening links, which includes dismissing any DevRev modal screens to facilitate handling your own deep links.\n\n#### In-app link callback\n\u003e [!NOTE]\n\u003e This feature is for Android only.\n\nFor scenarios where custom handling is needed, links from the support chat can be captured with the following method:\n\n```javascript\nDevRevSDK.setInAppLinkHandler(handler, successCallback, errorCallback)\n```\n\n### Analytics\n\u003e [!IMPORTANT]\n\u003e This feature requires the SDK to be configured and the user to be identified, whether they are unverified or anonymous.\n\nThe DevRev SDK allows you to send custom analytic events by using a properties map. You can track these events using the following function:\n\n```javascript\nDevRev.trackEvent(name, properties, successCallback, errorCallback)\n```\n\n### Session analytics\nThe DevRev SDK offers session analytics features to help you understand how users interact with your app.\n\n#### Opting-in or out\nSession analytics features are opted-in by default, enabling them from the start. However, you can opt-out using the following method:\n\n```javascript\nDevRev.stopAllMonitoring(successCallback, errorCallback)\n```\n\nTo opt back in, use the following method:\n\n```javascript\nDevRev.resumeAllMonitoring(successCallback, errorCallback)\n```\n\n#### Session recording\nYou can enable session recording to record user interactions with your app.\n\n\u003e [!CAUTION]\n\u003e The session recording feature is opt-out and is enabled by default.\n\nThe session recording feature includes the following methods to control the recording:\n\n- `DevRev.startRecording(successCallback, errorCallback)`: Starts the session recording.\n- `DevRev.stopRecording(successCallback, errorCallback)`: Stops the session recording and upload it to the portal.\n- `DevRev.pauseRecording(successCallback, errorCallback)`: Pauses the ongoing session recording.\n- `DevRev.resumeRecording(successCallback, errorCallback)`: Resumes a paused session recording.\n- `DevRev.processAllOnDemandSessions(successCallback, errorCallback)`: Stops the ongoing session recording and upload all offline sessions on demand, including the current one.\n\n#### Session properties\nYou can add custom properties to the session recording to help you understand the context of the session. The properties are defined as a map of string values.\n\n```javascript\nDevRev.addSessionProperties(properties, successCallback, errorCallback)\n```\n\nTo clear the session properties in scenarios such as user logout or when the session ends, use the following method:\n\n```javascript\nDevRev.clearSessionProperties(successCallback, errorCallback)\n```\n\n#### Masking sensitive data\nTo protect sensitive data, the DevRev SDK provides an auto-masking feature that masks data before sending to the server. Input views such as text fields, text views, and web views are automatically masked.\n\nWhile the auto-masking mechanism might be sufficient for most cases, to explicitly mask any WebView element on a webpage, use the CSS class `devrev-mask`. This ensures that sensitive elements, such as confidential text, remain hidden.\n\n##### Example (masked element):\n```html\n\u003clabel class=\"ue-mask\"\u003eFoo: Bar\u003c/label\u003e\n```\n\nIf any previously masked views need to be unmasked, you can use the following method:\n\n##### Example (unmasked element):\n```html\n\u003cinput type=\"text\" placeholder=\"Enter Foo\" name=\"foo\" required class=\"ue-unmask\"\u003e\n```\n\n#### Timers\nThe DevRev SDK offers a timer mechanism to measure the time spent on specific tasks, allowing you to track events such as response time, loading time, or any other duration-based metrics.\n\nThe mechanism uses balanced start and stop methods, both of which accept a timer name and an optional dictionary of properties.\n\nTo start a timer, use the following method:\n\n```javascript\nDevRev.startTimer(name, properties, successCallback, errorCallback)\n```\n\nTo stop a timer, use the following method:\n\n```javascript\nDevRev.endTimer(name, properties, successCallback, errorCallback)\n```\n\n#### Screen tracking\nThe DevRev SDK offers automatic screen tracking to help you understand how users navigate through your app. Although view controllers are automatically tracked, you can manually track screens using the following method:\n\n```javascript\nDevRev.trackScreenName(screenName, successCallback, errorCallback)\n```\n\n#### Screen transition tracking (Android only)\nOn Android, the DevRev SDK provides methods to manually track the screen transitions.\n\nWhen a screen transition begins, you must call the following method:\n\n```javascript\nDevRev.setInScreenTransitioning(true, successCallback, errorCallback)\n```\n\nWhen a screen transition ends, you must call the following method:\n\n```javascript\nDevRev.setInScreenTransitioning(false, successCallback, errorCallback)\n```\n\n### Push notifications\nYou can configure your app to receive push notifications from the DevRev SDK. The SDK is able to handle push notifications and execute actions based on the notification's content.\n\nThe DevRev backend sends push notifications to your app to notify users about new messages in the PLuG support chat.\n\n#### Configuration\nTo receive push notifications, you need to configure your DevRev organization by following the instructions in the [push notifications](https://developer.devrev.ai/public/sdks/mobile/push-notification) section.\n\n#### Register for push notifications\n\u003e [!IMPORTANT]\n\u003e To ensure delivery to the correct user, push notifications require that the SDK has been configured and the user has been identified.\n\nThe DevRev SDK offers a method to register your device for receiving push notifications. You can register for push notifications using the following method:\n\n```javascript\nDevRev.registerDeviceToken(deviceToken, deviceID, successCallback, errorCallback)\n```\n\nOn Android devices, the `deviceToken` must be the Firebase Cloud Messaging (FCM) token value. On iOS devices, it must be the Apple Push Notification Service (APNs) token.\n\n#### Unregister from push notifications\nIf your app no longer needs to receive push notifications, you can unregister the device.\n\nUse the following method to unregister the device:\n\n```javascript\nDevRev.unregisterDevice(deviceID, successCallback, errorCallback)\n```\n\nThe method requires the device identifier, which should be the same as the one used when registering the device.\n\n#### Processing push notification\n##### Android\nOn Android, notifications are implemented as data messages to offer flexibility. However, this means that automatic click processing isn't available. To handle notification clicks, developers need to intercept the click event, extract the payload, and pass it to a designated method for processing. This custom approach enables tailored notification handling in Android applications.\n\nTo process the notification, use the following method:\n\n```javascript\nDevRev.processPushNotification(payload, successCallback, errorCallback)\n```\nHere, the `message` object from the notification payload needs to be passed to this function.\n\n###### Example\n\n```javascript\nconst notificationPayload = {\n    \"message\": {\n        \"title\": \"New Message\",\n        \"body\": \"You have received a new message.\",\n        \"data\": {\n            \"messageId\": \"12345\",\n            \"sender\": \"John Doe\"\n        }\n    }\n};\n\nconst messageJson = notificationPayload[\"message\"];\n\nDevRev.processPushNotification(messageJson, function() {\n    console.log(\"Push notification processed successfully.\");\n}, function(error) {\n    console.error(\"Failed to process push notification:\", error);\n});\n```\n\n##### iOS\nOn iOS devices, you must pass the received push notification payload to the DevRev SDK for processing. The SDK will then handle the notification and execute the necessary actions.\n\n```javascript\nDevRev.processPushNotification(payload, successCallback, errorCallback)\n```\n\n###### Example\n\n```javascript\nconst notificationPayload = {\n    \"message\": {\n        \"title\": \"New Message\",\n        \"body\": \"You have received a new message.\",\n        \"data\": {\n            \"messageId\": \"12345\",\n            \"sender\": \"John Doe\"\n        }\n    }\n};\n\nconst messageJson = notificationPayload[\"message\"];\n\nDevRev.processPushNotification(messageJson, function() {\n    console.log(\"Push notification processed successfully.\");\n}, function(error) {\n    console.error(\"Failed to process push notification:\", error);\n});\n```\n\n## Sample app\nA sample app with use cases for the DevRev Cordova plugin has been provided as a part of our [public repository](https://github.com/devrev/devrev-sdk-cordova). To set up and run the sample app:\n\n```sh\ncd sample\nnpm install\ncordova platform add android\ncordova platform add ios\n```\n\n- **On Android:**\n  ```sh\n  cordova run android\n  ```\n  OR open `platforms/android` in Android Studio and run the app.\n\n- **On iOS:**\n1. Open `platforms/ios/Podfile` and ensure it contains:\n   ```ruby\n   platform :ios, '15.0'\n   ```\n2. Install dependencies:\n   ```sh\n   cd platforms/ios\n   pod install\n   ```\n3. Run the app:\n   ```sh\n     cordova run ios\n   ```\n   OR open `DevRevSDKSample.xcworkspace` in Xcode and run the app.\n\n## Troubleshooting\n- **Issue**: Support chat won't show.\n\t**Solution**: Ensure you have correctly called one of the identification methods: `DevRev.identifyUnverifiedUser(...)`, `DevRev.identifyVerifiedUser(...)`, or `DevRev.identifyAnonymousUser(...)`.\n\n- **Issue**: Not receiving push notifications.\n\t**Solution**: Ensure that your app is configured to receive push notifications and that your device is registered with the DevRev SDK.\n\n## Migration guide\nIf you are migrating from the legacy UserExperior SDK to the new DevRev SDK, please refer to the [Migration Guide](./MIGRATION.md) for detailed instructions and feature equivalence.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevrev%2Fdevrev-sdk-cordova","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevrev%2Fdevrev-sdk-cordova","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevrev%2Fdevrev-sdk-cordova/lists"}