Git Product home page Git Product logo

intercom's Introduction


Capacitor Intercom

@capacitor-community/intercom

Capacitor community plugin for enabling Intercom capabilities


Sponsors

Chatness AI

Maintainers

Maintainer GitHub Social
Stewan Silva stewones @stewones

Notice πŸš€

We're starting fresh under an official org. If you were using the previous npm package capacitor-intercom, please update your package.json to @capacitor-community/intercom. Check out changelog for more info.

Breaking changes from Capacitor v2 to v3

  • UserUpdateOptions option type becomes IntercomUserUpdateOptions
  • IntercomPlugin configuration key becomes Intercom
  • android-apiKey config key becomes androidApiKey
  • android-appId config key becomes androidAppId
  • ios-apiKey config key becomes iosApiKey
  • ios-appId config key becomes iosAppId
  • Switch from CAPBridge to ApplicationDelegateProxy in application events
  • remove the whole onCreate initialization from your app's MainActivity.java
 public class MainActivity extends BridgeActivity {
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        // Initializes the Bridge
-        this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
-            // Additional plugins you've installed go here
-            add(IntercomPlugin.class);
-        }});
-    }
 }

Installation

Using npm:

npm install @capacitor-community/intercom

Using yarn:

yarn add @capacitor-community/intercom

Sync native files:

npx cap sync

API

  • registerIdentifiedUser
  • registerUnidentifiedUser
  • updateUser
  • logout
  • logEvent
  • displayMessenger
  • displayMessageComposer
  • displayHelpCenter
  • hideMessenger
  • displayLauncher
  • hideLauncher
  • displayInAppMessages
  • hideInAppMessages
  • displayCarousel
  • setUserHash
  • setBottomPadding

Usage

import { Intercom } from '@capacitor-community/intercom';
import { PushNotifications } from '@capacitor/push-notifications';

// Register for push notifications from Intercom
PushNotifications.register();

// Register an indetified user
Intercom.registerIdentifiedUser({ userId: 123456 });
Intercom.registerIdentifiedUser({ email: '[email protected]' });
Intercom.registerIdentifiedUser({ userId: 123456, email: '[email protected]' });

// Register a log event
Intercom.logEvent({ name: 'my-event', data: { pi: 3.14 } });

// Display the message composer
Intercom.displayMessageComposer({ message: 'Hello there!' });

// Identity Verification
// https://developers.intercom.com/installing-intercom/docs/ios-identity-verification
Intercom.setUserHash({ hmac: 'xyz' });

iOS setup

  • ionic start my-cap-app --capacitor
  • cd my-cap-app
  • npm install β€”-save @capacitor-community/intercom
  • mkdir www && touch www/index.html
  • npx cap add ios
  • add intercom keys to capacitor's configuration file
{
 …
  "plugins": {
   "Intercom": {
      "iosApiKey": "ios_sdk-xxx",
      "iosAppId": "yyy"
    }
  }
…
}
  • npx cap open ios
  • sign your app at xcode (general tab)

Tip: every time you change a native code you may need to clean up the cache (Product > Clean build folder) and then run the app again.

Android setup

  • ionic start my-cap-app --capacitor
  • cd my-cap-app
  • npm install β€”-save @capacitor-community/intercom
  • mkdir www && touch www/index.html
  • npx cap add android
  • add intercom keys to capacitor's configuration file
{
 …
  "plugins": {
   "Intercom": {
      "androidApiKey": "android_sdk-xxx",
      "androidAppId": "yyy"
    }
  }
…
}
  • npx cap open android

Now you should be set to go. Try to run your client using ionic cap run android --livereload.

Tip: every time you change a native code you may need to clean up the cache (Build > Clean Project | Build > Rebuild Project) and then run the app again.

License

MIT

Example

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Stew

πŸ’» πŸ“–

David Seek

πŸ’»

Roman Nikitin

πŸ’»

Anne Tomassoni

πŸ’» πŸ‘€

Maciej Modzelewski

πŸ’»

Oleg Yuzvik

🚧

Gustavo CorrΓͺa Alves

πŸ“–

Jealvia

🚧

Adam Duren

πŸ’» 🚧

Rami Khafagi

πŸ’»

Masahiko Sakakibara

🚧

Dejardin Camille

πŸ’»

Mohamed Abdelgwad

🚧

Nathan

🚧

Cecil WΓΆbker

πŸ’» 🚧

Pavlo Pyrig

πŸ’»

Ruan

πŸ’»

RickJeroen

🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

intercom's People

Contributors

adamduren avatar atomassoni avatar cwoebker avatar davidseek avatar dependabot[bot] avatar dupiesdupreez avatar emilkaiser avatar gcorreaalves avatar jealvia avatar mevans avatar mmodzelewski avatar pavlopyrig0 avatar ramikhafagi96 avatar rdlabo avatar rickjeroen avatar rnikitin avatar scr2em avatar shark404 avatar spaghettiguru avatar stewones avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

intercom's Issues

Add support for push notifications on the Android platform.

Is your feature request related to a problem?

Push notifications seem not to be supported on the Android platform for this plugin.

Push notifications are a key part of any livechat integration as the user is likely to close/background the app after sending a message via the Intercom widget, and experiences with other chat platforms (e.g Facebook Messenger, WhatsApp, LINE, etc.) have set the expectation that a new message will be accompanied by a device-native push alert. It's a very unexpected and disappointing experience for the user if they need to constantly re-open the app and check the Intercom page for a new message (especially for real-time ecommerce).

This limitation is not currently referenced in the README file. As a result we had to abandon our integration efforts with this plugin half-way through and migrate to the Cordova plugin.


Describe the solution you'd like

This already seems to be implemented for iOS, the Android implementation should be very similar.

This plugin assumes the Capacitor Push plugin is used to register the user's device token for push notifications. When the application calls .register()...

image

... the device token is fetched. If successful, the registration event is raised and any associated listeners are executed:

image

A listener should be added to this event which captures the token and forwards to the Intercom native Android SDK. You can see this exact behaviour is implemented already in the iOS version:

image

Something similar should be implemented here on the Android version:

image

In the meantime it would be useful if the README could be updated to communicate this limitation of the plugin.

Extend updateUser method with additional properties

Intercom SDK allows adding some standard properties to user information. These fields would be: userId, email, name, phone.
I would like to have a possibility to add those properties via capacitor plugin.

This is a context issue, I will prepare a pull request with an extended updateUser method.

Android studio build fails bug

Describe the bug
when add capacitor-community/intercom pkg to my project , the build is failing as shown in the screenshoot

To Reproduce
Steps to reproduce the behavior:

  1. npm install capacitor-community/intercom
  2. npx cap sync
  3. npx cap open android
  4. wait until build
  5. See error

Expected behavior
build successfully

Screenshots
image

after adding json jar manually into intercom module another error came up

image

Desktop (please complete the following information):

  • OS: windows 11 (android studio ) version (2021.3.1.17)

Add support for 'companies' property

Is your feature request related to a problem? Please describe.
Feature parity with the Cordova Intercom plugin.

Describe the solution you'd like
Add support to update the intercom specific 'companies' property

Describe alternatives you've considered
Can use custom attributes instead but Intercom has a special case for the 'companies' property.

Additional context
Equivalent code within the intercom cordova plugin is here: https://github.com/intercom/intercom-cordova/blob/master/intercom-plugin/src/ios/IntercomBridge.m#L185

Bundle size after installing the plugin

Hi folks!

I want it to know if someone has this unexpected increase of the bundle size,

My app size was ~18Mb and after adding this plugin went to ~30Mb. (apk)

Is that normal?

Support for runtime configuration

Currently, the configuration sent to Intercom is done on the plugin load method. This is an issue if you do not have the keys at build time, or hardcoding them anywhere is not desired.

It would be good if the configuration could be sent at runtime, for example exposing a loadConfiguration plugin method that accepts the Intercom configuration, and would just set the Api key.

The existing load method would ignore the apiKey if not present in the capacitor.config.json.

CocoaPods could not find compatible versions for pod "Intercom" on 3.0.2

Describe the bug
After updating to 3.0.2, Pod install fails with:

[capacitor] βœ– Updating iOS native dependencies with pod install - failed!
[capacitor] βœ– update ios - failed!
[capacitor] [error] Analyzing dependencies
[capacitor]         [!] CocoaPods could not find compatible versions for pod "Intercom":
[capacitor]         In Podfile:
[capacitor]         CapacitorCommunityIntercom (from `../../node_modules/@capacitor-community/intercom`) was resolved to 3.0.2, which depends on
[capacitor]         Intercom (~> 11.2.0)
[capacitor]         
[capacitor]         Specs satisfying the `Intercom (~> 11.2.0)` dependency were found, but they required a higher minimum deployment target.

To Reproduce

npm I @capacitor-community/[email protected]
npx cap sync ios

Keep things consistent

Describe the bug
Keep things consistent: Could you please change the (in iOS) let userEmail = call.getString("userEmail") to email ? So they are consistent in iOS and Android. Or change the Andoird to userEmail if possible?

CALL: intercom.registerIdentifiedUser

Additional context
Also, can we please change the deployment_target to 12.0 ?

Android 13, SDK 33 - Unable to upload files

Describe the bug
I've integrated Intercom's capacitor-community v4.0.2. It's working well on iOS, and the conversation text is functioning properly on Android. However, I'm unable to attach files and I'm encountering an error message that says File permission access denied.

It's functioning well on Android 12 - SDK 32 when I include the READ_EXTERNAL_STORAGE permission in the Android manifest. However, file uploads are not working on Android 13 - SDK 33. I've updated the Android manifest with the below permissions, but I'm still unable to upload files.

<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />

Any help would be appreciated. Thanks

Error while registerIdentifiedUser

Error while calling registerIdentifiedUser
[Intercom] ERROR - Tried to update user but there was a network error (401) - Request failed: unauthorized (401)

Desktop (please complete the following information):

  • OS: MAC
  • XCODE
  • Version [13.4.1]

Smartphone (please complete the following information):

  • Device: [iPhone7]
  • OS: [1515.6]

unreadConversationCount

Hello,
In version Cordova , there is a unreadConversationCount method , it's possible to implement in capacitor version ?

Identity verification

Hey guy,

first of all thanks for the project.
I have an active native iOS app in store and now reworking to
have Android using Ionic.

I'm using Intercom's feature for identity verification.
Basically registering the user with a hash code.

https://app.intercom.io/a/apps/prokjmrn/settings/identity-verification/ios
https://developers.intercom.com/installing-intercom/docs/ios-identity-verification

Intercom.setUserHash("your_hmac_of_user_id_or_email")

Therefore I'm getting 401 Server response.
Can you please add an API for reg with hash or give instructions?

Thank you.

iOS Type 'Intercom' has no member 'loginUser' / 'loginUnidentifiedUser'

Describe the bug
Attempting to build your Capacitor iOS project with @capacitor-community/intercom installed fails due to the Type 'Intercom' has no member.... errors.

To Reproduce
Steps to reproduce the behavior:

  1. npm install @capacitor-community/intercom
  2. npx cap sync
  3. Attempt to build your iOS project
  4. See error

Expected behavior
The build should succeed.

Screenshots
Link to XCode error here.

Additional context
I have created a fork of this repo of the steps I took to get the build to succeed, which you can view here.

I've never written Swift before so I haven't handled any errors / might have made some other errors -- but I'm more than happy to spend some time doing this if it will help get this merged into this repo.

This issue was mentioned in this closed issue, I mentioned it in that issue, but now that I've forked an example of how to fix I think it's okay to create a new issue. If not, please feel free to close & apologies for the spam πŸ‘

Thanks to all the contributors and maintainers for this wonderful Capacitor plugin! πŸ˜„

Before:
Intercom.loginUser(with: attributes)...

After:
Intercom.registerUser(withEmail: attributes.email!)

Use with capacitor-analytics

Hi Stewwan,

I have already implemented your plugin capacitor-analytics v0.0.4. Can I also use this for inAppMessages? Also is this plugin interfiring with Capacitor build in Push notification in any way?

Finally which version should I use If I have the 0.0.4 of analytics?

Thanks again

Web support?

Are there any plans to add web support to this plugin? I see some commented out code that suggests web support was started on.

Push for IOS

Hello,

Thank you very much for this great plugin :)
I installed it and it works great.
Now I would like to enable push notifications, I configured everything in the application by activating the push module on Xcode, I added the certificate to intercom and I put PushNotifications.register() in the code.
Push register work : To Native -> PushNotifications register 132998746

But now what should I do, because I am not receiving messages?

Thank you for your help

Gil

Type 'Intercom' has no member XXX

Describe the bug
After upgrading this plugin to 5.0.0 my ios package fails to build.

Shows three errors:

  • Type 'Intercom' has no member 'presentMessenger'
  • Type 'Intercom' has no member 'presentCarousel'
  • Type 'Intercom' has no member 'presentHelpCenter'
  • Type 'Intercom' has no member 'presentArticle'

Expected behavior
The package builds correctly

Screenshots
Screenshot 2023-10-04 at 12 56 54β€―PM

Feature Request: Unread message count

Hi,

The previous Cordova SDK featured means to get the unread messages count for a user. Would it be possible to implement the mentioned feature here too please? Thanks.

Using FCM token in iOS breaks push notifications for intercom

Describe the bug
On iOS, If you fetch the firebase FCM token instead of the raw APNS token and use that for the capacitorDidRegisterForRemoteNotifications listener, push notifications do not work.

To Reproduce

  1. follow guide for installing and using @capacitor/push-notifications
  2. follow guide for installing and using @capacitor-community/intercom
  3. Use the following code in AppDelegate, as mentioned in the capacitor push notifications guide
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        Messaging.messaging().apnsToken = deviceToken
        NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken)
        Messaging.messaging().token(completion: { (token, error) in
            if let error = error {
                NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
            } else if let token = token {
                NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: token)
            }
        })
    }

To Fix
I have resolved this by adding the following line in my AppDelegate didRegisterForRemoteNotificationsWithDeviceToken method but I am not sure if this is the ideal solution as I do not know a lot of Swift.

Intercom.setDeviceToken(deviceToken)

So now the function looks like this and I can receive both APNS notifications from Intercom and FCM notifications from firebase.

  func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        Intercom.setDeviceToken(deviceToken)
        Messaging.messaging().apnsToken = deviceToken
        NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken)
        Messaging.messaging().token(completion: { (token, error) in
            if let error = error {
                NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
            } else if let token = token {
                NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: token)
            }
        })
    }

Smartphone:

  • iPhone 12: [e.g. iPhone6]
  • OS: 15.1.1

Is Capacitor v4 compatible ?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Android Messenger crash on Capacitor v4.4.0

Describe the bug
displayMessageComposer() and displayMessenger() are crashing the app in Android for Capacitor v4.4.0.

I've been using this plugin for long time and after upgrading from capacitor 4.2.0 to 4.4.0 the app starts crashing when trying to open the messenger. It happens in all devices with all Android versions.

To Reproduce
Steps to reproduce the behavior:

  1. Upgrade to capacitor/[email protected]
  2. Call displayMessageComposer() or displayMessenger() methods
  3. App will crash

Smartphone (please complete the following information):

  • Device: All Android devices
  • OS: Android 10/11/12 same behaviour

Stacktrace
Exception java.lang.NoSuchMethodError: at io.intercom.android.sdk.utilities.IntercomCoilKt.getImageLoader (IntercomCoil.kt:45) at io.intercom.android.sdk.utilities.IntercomCoilKt.loadIntercomImage (IntercomCoil.kt:20) at io.intercom.android.sdk.imageloader.WallpaperLoader.loadWallpaperInto (WallpaperLoader.java:55) at io.intercom.android.sdk.profile.ProfilePresenter.loadWallpaperInto (ProfilePresenter.java:232) at io.intercom.android.sdk.profile.TeammateProfilePresenter.<init> (TeammateProfilePresenter.java:143) at io.intercom.android.sdk.profile.ProfilePresenter.<init> (ProfilePresenter.java:85) at io.intercom.android.sdk.conversation.ConversationFragment.onCreateView (ConversationFragment.java:284) at androidx.fragment.app.Fragment.performCreateView (Fragment.java:3104) at androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:524) at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:261) at androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:1890) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:1808) at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:1751) at androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:2976) at androidx.fragment.app.FragmentManager.dispatchActivityCreated (FragmentManager.java:2886) at androidx.fragment.app.FragmentController.dispatchActivityCreated (FragmentController.java:263) at androidx.fragment.app.FragmentActivity.onStart (FragmentActivity.java:351) at androidx.appcompat.app.AppCompatActivity.onStart (AppCompatActivity.java:246) at android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1455) at android.app.Activity.performStart (Activity.java:8315) at android.app.ActivityThread.handleStartActivity (ActivityThread.java:4060) at android.app.servertransaction.TransactionExecutor.performLifecycleSequence (TransactionExecutor.java:221) at android.app.servertransaction.TransactionExecutor.cycleToPath (TransactionExecutor.java:201) at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:173) at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2438) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loopOnce (Looper.java:226) at android.os.Looper.loop (Looper.java:313) at android.app.ActivityThread.main (ActivityThread.java:8669) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)

Receive native push notifications from Intercom chat

Describe the bug
I can not receive a native notification

To Reproduce
Steps to reproduce the behavior:

  1. Open app
  2. Send message to the user from the intercom panel
  3. I don't receive the native notification but if I am inside the app I receive the notification with:
    PushNotifications.addListener(
    'pushNotificationReceived',
    (notification: PushNotificationSchema) => {
    console.debug('Push received: ' + JSON.stringify(notification))
    }
    )

Expected behavior
See a native notification
Example:
Image from iOS

Desktop (please complete the following information):

  • OS: [Android. iOS]

Smartphone (please complete the following information):

  • Device: all

Display message composer not working correctly

Describe the bug
Hi, displayMessageComposer is not open the plugin with the message.

Desktop (please complete the following information):

  • OS: Android
  • Version 11

Additional context
The solution is changing the 123 line in the file: https://github.com/capacitor-community/intercom/blob/master/android/src/main/java/com/getcapacitor/community/intercom/IntercomPlugin.java,
by:
String message = call.getString("message");
Intercom.client().displayMessageComposer(message);

No such module 'Intercom'

Describe the bug
I was using v3.0.0 then I upgraded to 4.0.1, now I get a No such module 'intercom' error

Screenshots
image

Desktop (please complete the following information):

  • OS: mac ventura
  • XCode: 14.1

IOS Intercom.registerUser does not exist

Describe the bug
I have a React + Capacitor app. I had installed this capacitor plugin as the directions instruct. For Android, everything works perfectly, for IOS, the build fails because of the error Type 'Intercom' has no member 'registerUser'

Expected behavior
Build completes and am able to run it successfully.

Screenshots
If applicable, add screenshots to help explain your problem.
Screen Shot 2022-09-20 at 7 52 17 PM

Additional context
Add any other context about the problem here.
After npx cap doctor

Latest Dependencies:

  @capacitor/cli: 4.2.0
  @capacitor/core: 4.2.0
  @capacitor/android: 4.2.0
  @capacitor/ios: 4.2.0

Installed Dependencies:

  @capacitor/cli: 4.2.0
  @capacitor/core: 4.2.0
  @capacitor/android: 4.2.0
  @capacitor/ios: 4.2.0

[success] iOS looking great! πŸ‘Œ
[success] Android looking great! πŸ‘Œ

AndroidX issues with Intercom plugin

While attempting to build Capacitor app after adding the intercom plugin, I get the error below in Android Studio:

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
	is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
	Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-51:19 to override.

Similar issues on the internet suggest adding:

android.useAndroidX=true
android.enableJetifier=true

to the build.gradle file, but doing that throws a different error with AppCompat.

@capacitor\android\capacitor\src\main\java\com\getcapacitor\Plugin.java:9: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
                             ^
  symbol:   class ActivityCompat

Any solution for this will be greatly appreciated, thanks.

Push notifications not working for Android

Describe the bug
I'm unable to get push notifications working on Android. I'm guessing this is a config/setup issue, but since this issue has come up a few times I was hoping to get it working and then contribute better instructions to this repo.

To Reproduce

  1. Install and configure @capacitor/push-notifications
  2. Enable Cloud Messaging API in Firebase (legacy) and add the Server key to Intercom (Settings > Install > Android > Push)
  3. Install and configure this plugin
  4. Add app code:
    import { Intercom } from '@capacitor-community/intercom';
    import { PushNotifications } from '@capacitor/push-notifications';
    PushNotifications.requestPermissions();
    PushNotifications.register();
    Intercom.registerUnidentifiedUser();
    Intercom.displayLauncher();
    
  5. Launch app > send Intercom message > close the app > reply to the message from the Intercom Inbox

Expected: Receive a push notification on the device after ~10 seconds.

Result: Nothing. The message comes through as expected if you resume the app.

Additional context

  • I confirmed the device/app can receive push notifications via a manual Firebase Cloud Messaging notification to the registration token
  • Push works on iOS as expected
  • Confirmed the app has notification permissions enabled
  • Tested on multiple devices with the app installed both via Android Studio and via Internal app sharing on the Play Store

Platforms:

  • OS: Android, various devices/versions

Any help greatly appreciated!

setBottomPadding error?

Hey, while implementing the new version I'm edging on this:

⚑️ Error: Plugin IntercomPlugin does not respond to method call "setBottomPadding" using selector "setBottomPadding:".

Any idea what that's about?

Implementation pretty straight forward:

const paddingOptions = {
   value: '128'
}

intercom.setBottomPadding(paddingOptions)
   .then(() => {

      console.log('Intercom padding success')
    })
    .catch(error => {

      console.log('Intercom padding error: ', error)
})

Messenger close button handler

As the messenger opens in a new window(activity) it would be very useful to have a close button listener.

I have a custom privacy screen that i don't want to show when the messenger is opened.
I'm saving a flag in the storage when i call displayMessenger() so the privacy screen doesn't show up but as there is no listener on the close button or the back button, I can't reset said flag.

I'm trying to implement it myself, if you have the possibility to integrate it, it would be amazing and time saver for me.

Thanks

Error using plugin in Andoird: Cannot read property 'registerIdentifiedUser'

Error using plugin in Andoird

When I want to use:

import { Intercom } from "@capacitor-community/intercom";

this.platform.ready().then(() => {
Plugins.IntercomPlugin.registerIdentifiedUser({userId:'xxx'})
})

Throw the following error only on Android.

Cannot read property 'registerIdentifiedUser'

On iOS it works fine.

ionic info

Ionic:

Ionic CLI : 5.4.9 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 5.0.3
@angular-devkit/build-angular : 0.803.25
@angular-devkit/schematics : 8.3.25
@angular/cli : 8.3.25
@ionic/angular-toolkit : 2.2.0

Capacitor:

Capacitor CLI : 2.3.0
@capacitor/core : 2.3.0

Cordova:

Cordova CLI : 8.0.0
Cordova Platforms : android 8.0.0, browser 5.0.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 11 other plugins)

Utility:

cordova-res : 0.15.1 (update available: 0.15.3)
native-run : not installed

System:

Android SDK Tools : 26.1.1 (/Users/sergiosanabria/Library/Android/sdk/)
ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v12.18.3 (/Users/sergiosanabria/.nvm/versions/node/v12.18.3/bin/node)
npm : 6.14.6
OS : macOS
Xcode : Xcode 12.3 Build version 12C33

Capacitor 3 support

Is your feature request related to a problem? Please describe.
Currently not being able to run on Capacitor 3

Getting TypeError: undefined is not an object (evaluating 'IntercomPlugin.registerIdentifiedUser')

Describe the solution you'd like
Hey @stewones Can we get Capacitor 3 support?

Describe alternatives you've considered
I have tried the cordova-plugin-intercom but it still get me the same error I got 13 months ago

SDK upgrade notification

Hi David,

To continue to provide all Intercom users with a fast and secure mobile experience, we are deprecating version 5 and below of the Intercom mobile SDKs. 

Starting June 30th 2020, version 5 and below of the iOS and Android SDKs will no longer be supported, and will no longer work on your site. 

To continue to use Intercom in your apps, please upgrade to version 6 of the mobile SDKs. 

To learn how to upgrade, check out our documentation for Android and iOS.

After you upgrade, we advise you to encourage your customers to upgrade to the latest version of your app. End users still using an older version of your app won’t be able to access Intercom after June 30th.

Version 6 supports Android API level 21 and iOS 10 and above. You can expect to see new features and updates in these versions moving forward. 

If you have any questions, please let us know.

Thanks,
Mathew

non-static method getString(String,String) cannot be referenced from a static context

Hi,

We have an existing project that this error is happening on but I just installed a fresh ionic app and and added this plugin following the guide for android in your readme, but when I compile I get the same error as in the existing project.

I have included my keys from intercom in my capacitor.config.json and updated the MainActivity.java and checked that the keys are up to date.

Instructions to reproduce

ionic start myApp tabs

npm install --save capacitor-intercom

Add Android keys to capacitor.config.json

npx cap add android

npx cap open android

Update MainActivity.java

Run from android studio.

When trying to run the app from android studio the following errors appears when setting the appId and appKey.

non-static method getString(String,String) cannot be referenced from a static context

How can I resolve this issue or what am I doing wrong?

Build failes with Capacitor v3.5.1

The npx cap sync command failes after upgrading to capacitor v3.5.1:

βœ– Updating iOS native dependencies with pod install - failed!
βœ– update ios - failed!
[error] Analyzing dependencies
        [!] CocoaPods could not find compatible versions for pod "Capacitor":
        In Podfile:
        Capacitor (from `../../node_modules/@capacitor/ios`)

        CapacitorCommunityIntercom (from `../../node_modules/@capacitor-community/intercom`) was resolved to 3.0.2,
        which depends on
        Capacitor (~> 3.4.3)

Is there a reason why there is a hard dependency to v3.4.3?

intercom NSLayoutConstraint error

Device: iPod touch 6th generation
Model: MKJ02VC/A
Software Version: 12.5.5

"@capacitor-community/fcm": "^2.0.2",
"@capacitor-community/intercom": "^3.0.1",
"@capacitor/core": "^3.2.5",
"@capacitor/device": "^1.0.5",
"@capacitor/ios": "^3.2.5",

To Native -> Intercom displayMessenger 70889363
⚑️ TO JS undefined
2021-10-30 12:43:12.371134-0400 ***[2079:498657] Unbalanced calls to begin/end appearance transitions for <ICMRootViewController: 0x10303faa0>.
2021-10-30 12:43:12.433219-0400 ***[2079:498657] <CATransformLayer: 0x282ea9260> - changing property borderColor in transform-only layer, will have no effect
2021-10-30 12:43:12.433485-0400 ***[2079:498657] <CATransformLayer: 0x282ea9260> - changing property cornerRadius in transform-only layer, will have no effect
2021-10-30 12:43:12.433643-0400 ***[2079:498657] <CATransformLayer: 0x282ea9260> - changing property borderWidth in transform-only layer, will have no effect
2021-10-30 12:43:12.472135-0400 ***[2079:498657] *** Assertion failure in -[NSLayoutConstraint setPriority:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1575.23/Foundation/Layout.subproj/NSLayoutConstraint.m:234
2021-10-30 12:43:12.475215-0400 ***[2079:498657] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Mutating a priority from required to not on an installed constraint (or vice-versa) is not supported. You passed priority 999 and the existing priority was 1000.'
*** First throw call stack:
(0x1be7ea180 0x1bd9c29f8 0x1be70388c 0x1bf1c7b38 0x1bf163978 0x101901b6c 0x101901590 0x1ea00d3c4 0x1ea00d9c0 0x1018d6490 0x1018d6340 0x1e9ffae44 0x1ea015d20 0x1ea013574 0x1ea018084 0x1eab928f0 0x1ea0171c8 0x1ea0124e8 0x1ea0191b8 0x1ea0194ec 0x1ea01934c 0x1ea0192d0 0x1ea01920c 0x1018d453c 0x1eab9425c 0x1eab94870 0x1018d43e4 0x102ea36f4 0x102ea4c78 0x102eb26fc 0x1be77bb20 0x1be776a58 0x1be775fb4 0x1c097879c 0x1ea708c38 0x100daa964 0x1be2398e0)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Mutating a priority from required to not on an installed constraint (or vice-versa) is not supported. You passed priority 999 and the existing priority was 1000.'
terminating with uncaught exception of type NSException

Capacitor 3 requires iOS 12.1, so this plugin results in a compilation error:

Compiling for iOS 11.0, but module 'Capacitor' has a minimum deployment target of iOS 12.0: intercom for iOS 11.0, but module 'Capacitor' has a minimum deployment target of iOS 12.0

The target can be adjusted in XCode manually but is lost on every cap sync

(Maybe I meant 12.0 instead of 12.1 actually, but xcode only let me pick 12.1)

What is Intercom?

Hi,

Cannot understand the idea of this plugin, can you put some description? more useful to know what i can do with it? Thanks

Cannot find module '@capacitor-community/intercom' or its corresponding type declarations.ts

Describe the bug
The dependency @capacitor-community/intercom cant be resolved

To Reproduce
Steps to reproduce the behavior:

  1. Clone the example solution (https://github.com/capacitor-community/intercom/tree/master/example)
  2. Run 'npm i' to download dependencies
  3. See error persisting on import
    import { Intercom } from '@capacitor-community/intercom';
    (Cannot find module '@capacitor-community/intercom' or its corresponding type declarations.ts)

Expected behavior
To resolve the dependency

Screenshots
image

Desktop (please complete the following information):

  • Windows 11
  • VS code

Add support on Android for showing surveys when set live in the intercom web application

Is your feature request related to a problem? Please describe.
When we create a survey on intercom web app, it is displayed on iOS but no android (using latest version of the plugin, 4.0.2)

https://github.com/intercom/intercom-android/blob/master/CHANGELOG.md#-enhancements

Describe the solution you'd like
Upgrade the capacitor plugin to support surveys shown when set live on android, like it is done on iOS. This probably requires to upgrade the android intercom sdk to their latest version:

Describe alternatives you've considered
We tried upgrading the android sdk version in our variables.gradle to 14.0.4 without changing the plugin's code but this did not work, there are probably some code changes necessary in the android code of the plugin as well

Main Thread Checker: UI API called on a background thread when calling Intercom.registerUnidentifiedUser()

When calling Intercom.registerUnidentifiedUser() in the application, the Main Thread Checker reports a UI API call on a background thread with the following backtrace:

Main Thread Checker: UI API called on a background thread: -[UIApplication supportsMultipleScenes]
PID: 1506, TID: 73284, Thread name: (none), Queue name: bridge, QoS: 0
Backtrace:
4   Intercom                            0x00000001011eb894 IntercomSDK_PINRemoteImageManagerSubclassOverridesSelector + 814416
5   Intercom                            0x000000010116ad58 IntercomSDK_PINRemoteImageManagerSubclassOverridesSelector + 287252
6   Intercom                            0x000000010116a9b4 IntercomSDK_PINRemoteImageManagerSubclassOverridesSelector + 286320
7   Intercom                            0x0000000100f97960 Intercom + 31072
8   Intercom                            0x0000000100f96638 Intercom + 26168
9   Intercom                            0x0000000100f97c94 Intercom + 31892
10  CapacitorCommunityIntercom          0x00000001002e33f8 $s26CapacitorCommunityIntercom0C6PluginC24registerUnidentifiedUseryySo13CAPPluginCallCF + 64
11  CapacitorCommunityIntercom          0x00000001002e344c $s26CapacitorCommunityIntercom0C6PluginC24registerUnidentifiedUseryySo13CAPPluginCallCFTo + 52
12  Capacitor                           0x0000000100678000 $s9Capacitor0A6BridgeC12handleJSCall4callyAA0D0V_tFyycfU0_ + 856
13  Capacitor                           0x000000010066c4a8 $sIeg_IeyB_TR + 48
14  libdispatch.dylib                   0x0000000100568520 _dispatch_call_block_and_release + 32
15  libdispatch.dylib                   0x000000010056a038 _dispatch_client_callout + 20
16  libdispatch.dylib                   0x00000001005720b0 _dispatch_lane_serial_drain + 984
17  libdispatch.dylib                   0x0000000100572df4 _dispatch_lane_invoke + 412
18  libdispatch.dylib                   0x000000010057fc74 _dispatch_workloop_worker_thread + 736
19  libsystem_pthread.dylib             0x000000020216fddc _pthread_wqthread + 288
20  libsystem_pthread.dylib             0x000000020216fb7c start_wqthread + 8
2023-08-01 12:44:11.879635+0100 App[1506:73284] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication supportsMultipleScenes]
PID: 1506, TID: 73284, Thread name: (none), Queue name: bridge, QoS: 0
Backtrace:
4   Intercom                            0x00000001011eb894 IntercomSDK_PINRemoteImageManagerSubclassOverridesSelector + 814416
5   Intercom                            0x000000010116ad58 IntercomSDK_PINRemoteImageManagerSubclassOverridesSelector + 287252
6   Intercom                            0x000000010116a9b4 IntercomSDK_PINRemoteImageManagerSubclassOverridesSelector + 286320
7   Intercom                            0x0000000100f97960 Intercom + 31072
8   Intercom                            0x0000000100f96638 Intercom + 26168
9   Intercom                            0x0000000100f97c94 Intercom + 31892
10  CapacitorCommunityIntercom          0x00000001002e33f8 $s26CapacitorCommunityIntercom0C6PluginC24registerUnidentifiedUseryySo13CAPPluginCallCF + 64
11  CapacitorCommunityIntercom          0x00000001002e344c $s26CapacitorCommunityIntercom0C6PluginC24registerUnidentifiedUseryySo13CAPPluginCallCFTo + 52
12  Capacitor                           0x0000000100678000 $s9Capacitor0A6BridgeC12handleJSCall4callyAA0D0V_tFyycfU0_ + 856
13  Capacitor                           0x000000010066c4a8 $sIeg_IeyB_TR + 48
14  libdispatch.dylib                   0x0000000100568520 _dispatch_call_block_and_release + 32
15  libdispatch.dylib                   0x000000010056a038 _dispatch_client_callout + 20
16  libdispatch.dylib                   0x00000001005720b0 _dispatch_lane_serial_drain + 984
17  libdispatch.dylib                   0x0000000100572df4 _dispatch_lane_invoke + 412
18  libdispatch.dylib                   0x000000010057fc74 _dispatch_workloop_worker_thread + 736
19  libsystem_pthread.dylib             0x000000020216fddc _pthread_wqthread + 288
20  libsystem_pthread.dylib             0x000000020216fb7c start_wqthread + 8
2023-08-01 12:44:11.881516+0100 App[1506:72977] [Intercom] INFO - Registering an unidentified user.
This issue occurs when Intercom.registerUnidentifiedUser() is invoked. It seems to trigger UI API calls on a background thread, leading to the Main Thread Checker warnings.

Expected Behavior:
The method Intercom.registerUnidentifiedUser() should not trigger UI API calls on background threads and should be executed on the main thread.

Steps to Reproduce:

Call Intercom.registerUnidentifiedUser() in the application.

Code:

  constructor(public platform: Platform) {
    Intercom.registerUnidentifiedUser();
}

Environment:

iOS version: iOS 16.4.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.