{"id":15282617,"url":"https://github.com/essent/nativescript-live-engage","last_synced_at":"2025-05-07T02:43:30.764Z","repository":{"id":18132621,"uuid":"83405713","full_name":"Essent/nativescript-live-engage","owner":"Essent","description":"A NativeScript plugin to display a LivePerson LiveEngage chat on Android/iOS","archived":false,"fork":false,"pushed_at":"2023-01-07T17:57:53.000Z","size":59827,"stargazers_count":8,"open_issues_count":15,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T08:05:39.834Z","etag":null,"topics":["live-engage","live-person","liveperson","nativescript","nativescript-live-engage","nativescript-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"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/Essent.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}},"created_at":"2017-02-28T07:59:32.000Z","updated_at":"2025-02-05T02:07:51.000Z","dependencies_parsed_at":"2023-01-14T07:00:12.983Z","dependency_job_id":null,"html_url":"https://github.com/Essent/nativescript-live-engage","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Essent%2Fnativescript-live-engage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Essent%2Fnativescript-live-engage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Essent%2Fnativescript-live-engage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Essent%2Fnativescript-live-engage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Essent","download_url":"https://codeload.github.com/Essent/nativescript-live-engage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252802608,"owners_count":21806537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["live-engage","live-person","liveperson","nativescript","nativescript-live-engage","nativescript-plugin"],"created_at":"2024-09-30T14:31:43.122Z","updated_at":"2025-05-07T02:43:30.740Z","avatar_url":"https://github.com/Essent.png","language":"TypeScript","readme":"# NativeScript plugin for LivePerson LiveEngage\n\n[![npm version](https://badge.fury.io/js/nativescript-live-engage.svg)](https://www.npmjs.com/package/nativescript-live-engage)\n\nThis is a plugin to show the conversation from a LiveEngage chat, using the LP-Messaging SDK ([Android](https://github.com/LP-Messaging/Android-Messaging-SDK) v3.6.0, [iOS](https://github.com/LP-Messaging/iOS-Messaging-SDK) v3.6.0).\n\n## Requirements\n* Xcode 11.x\n* Android SDK 28\n* NativeScript CLI 6.x\n* [LivePerson account](https://www.liveperson.com)\n\n## Installation\nRun the following command from the root of your project:\n\n```console\nnpm install nativescript-live-engage\n```\n\n### Setup\nAt the launch of your app call `initializeChat` with your credentials (our example [main.ts](./demo/app/main.ts)):\n```ts\nLiveEngage.getInstance().initializeChat('12345678', 'com.example.myapp');\n```\n\n#### Android\n1. Set the minSdkVersion to at least 19, in your [AndroidManifest.xml](./demo/app/App_Resources/Android/src/main/AndroidManifest.xml) and [app.gradle](./demo/app/App_Resources/Android/app.gradle).\n   \n2. Include the following dependencies in the include.gradle file of your app:\n   ```gradle\n     compile \"com.android.support:appcompat-v7:24.2.1\"\n     compile \"com.android.support:design:24.2.1\"\n     compile \"com.android.support:percent:24.2.1\"\n     compile 'com.google.android.gms:play-services-maps:9.8.0'\n     compile 'com.android.support.constraint:constraint-layout:1.0.2'\n   \n     compile 'com.squareup.picasso:picasso:2.5.2'\n     compile 'com.neovisionaries:nv-websocket-client:1.31'\n     compile 'com.squareup.okhttp3:okhttp:3.6.0'\n     ```\n\n#### iOS\nYou need to enable keychain sharing, to do this we need a custom entitlements file with a keychain-access-groups key.\n\nAdd [nativescript-custom-entitlements](https://github.com/Essent/nativescript-custom-entitlements) to your devDependencies and create a new entitlements file like our example [app.entitlements](./demo/app/App_Resources/iOS/app.entitlements).\n\n### Chatting\nTo open the chat window call `showChat`:\n```ts\nLiveEngage.getInstance().showChat();\n```\n\n### Optional functions\n\n#### Setting customer information\nAdd the first name, last name, nick name, avatar url or phone number of a user.\n```ts\nconst chatProfile: ChatProfile = {\n          firstName: 'Jane',\n          lastName: 'Doe',\n          nickName: 'JD',\n          phone: '0132100000',\n          avatarUrl: ''\n      };\nLiveEngage.getInstance().setUserProfileValues(chatProfile);\n```\n\n#### oAuth\nAdd a JWT for oAuth support when starting a conversation. Make sure you configure the Live Person data source to support the oAuth 2 authentication in terms of Live person public keys, Signing identities and possible (custom) claims definitions. Make sure to call this method before you start the conversation.\n```ts\nLiveEngage.getInstance().setAuthenticationCode('\u003cJWT encoded token string\u003e');\n```\n\n#### Hiding chat\nWhen you want to hide the chat window programmatically call `closeChat()`.\n```ts\nLiveEngage.getInstance().closeChat();\n```\n\n#### Logging Out\nWhen you want to remove all user data and unregister for push notifications call `killChat()`.\n\n```ts\nLiveEngage.getInstance().killChat()\n            .then(() =\u003e {\n                console.log('killChat success');\n            }).catch((error: any) =\u003e {\n                console.log('killChat error', error);\n        });\n```\n\n#### Push Notifications\nTo recieve push notifications when the agent sends a new message you need to send the push token to LivePerson.\nWhen you have a push token (FCM for Android and APNS for iOS) you can send it to LivePerson using `registerPushToken`\n```ts\nLiveEngage.getInstance().registerPushToken('your-token');\n```\n\n#### Parsing message on Android\nTo parse the push notification message on android in `onMessageReceived()` in your FirebaseMessagingService, use `parsePushMessage()`.\nThis will return a `PushMessageParser` object which has the method `getMessage()` to return the title of the push message.\n```ts\ntry {\n    const message = LiveEngage.getInstance().parsePushMessage(data);\n    console.log(message.getMessage());\n} catch (e) {\n    console.error(\"Failed to parse message:\", e);\n}\n```\n\n#### Getting unread message count\nTo get the total amount of unread messages, use `getUnreadMessagesCount()`.\nThis will only work when push notifications are enabled.\n```ts\nLiveEngage.getInstance().getUnreadMessagesCount((count: number) =\u003e {\n    console.log('Unread messages:', count);\n}, (error: any) =\u003e {\n    console.log('Failed to get count: ', error);\n});\n```\n\n#### Close window callback on iOS\nTo get notified when the conversation was dismissed, you can provide a callback when opening the chat on iOS:\n```ts\nLiveEngage.getInstance().showChat(() =\u003e {\n    console.log('Chat window was closed');\n});\n```\n\n### Development setup\n\nFor easier development and debugging purposes continue with the following steps:\n\nOpen a command prompt/terminal, navigate to src folder and run `npm run demo.ios` or `npm run demo.android` to run the demo.\n\nNow go and make a change to your plugin. It will be automatically applied to the demo project.\n\n#### Clean plugin and demo files\n\nSometimes you may need to wipe away all generated folders to reinstall them fresh.\nRun `npm run clean` to wipe those clean then you can can run `plugin.prepare` to install fresh dependencies.\n\nSometimes you just need to wipe out the demo's platforms, node_modules and hooks directory only.\nRun ```npm run demo.reset``` to delete those.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fessent%2Fnativescript-live-engage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fessent%2Fnativescript-live-engage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fessent%2Fnativescript-live-engage/lists"}