@capacitor-community/intercom

中文文档
8.0.0发布于 2026/03/24MITTypeScriptESM + CJS零依赖近 30 天下载 10.4万

Enable Intercom features for Capacitor apps

原始使用文档
文档目录38 节
  1. Capacitor Intercom
  2. Maintainers
  3. Compatibility
  4. Installation
  5. Usage
  6. iOS setup
  7. Android setup
  8. API
  9. loadWithKeys(...)
  10. registerIdentifiedUser(...)
  11. registerUnidentifiedUser()
  12. updateUser(...)
  13. logout()
  14. logEvent(...)
  15. displayMessenger()
  16. displayMessageComposer(...)
  17. displayHelpCenter()
  18. hideMessenger()
  19. displayLauncher()
  20. hideLauncher()
  21. displayInAppMessages()
  22. hideInAppMessages()
  23. displayCarousel(...)
  24. setUserHash(...)
  25. setUserJwt(...)
  26. setBottomPadding(...)
  27. sendPushTokenToIntercom(...)
  28. receivePush(...)
  29. displayArticle(...)
  30. addListener('windowDidShow', ...)
  31. addListener('windowDidHide', ...)
  32. removeAllListeners()
  33. Interfaces
  34. Notice 🚀
  35. Breaking changes from Capacitor v2 to v3
  36. License
  37. Example
  38. Contributors ✨


Capacitor Intercom

@capacitor-community/intercom

Capacitor community plugin for enabling Intercom capabilities


Maintainers

MaintainerGitHubSocial
Stewan Silvastewones@stewones

Compatibility

CapacitorIntercom iOSIntercom AndroidiOS TargetAndroid Target
8.x18.x17.x15.036
7.x18.x15.x15.035
6.x16.x12.x13.034

Note: This plugin follows semantic versioning aligned with Capacitor and maintains compatibility with Intercom SDKs (iOS, Android). If you encounter any issues due to versioning inconsistencies, please open an issue to help us improve the plugin.

Installation

Using npm:

npm install @capacitor-community/intercom

Using yarn:

yarn add @capacitor-community/intercom

Sync native files:

npx cap sync

Usage

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

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

// Register an identified 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' });

// Secure Your Messenger
// https://developers.intercom.com/installing-intercom/ios/secure-your-messenger
Intercom.setUserJwt({ jwt: 'xyz' });

iOS setup

  • ionic start my-cap-app --capacitor
  • cd my-cap-app
  • npm install @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 @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.

API

loadWithKeys(...)

loadWithKeys(options: { appId?: string; apiKeyIOS?: string; apiKeyAndroid?: string; }) => Promise<void>
ParamType
options{ appId?: string; apiKeyIOS?: string; apiKeyAndroid?: string; }

registerIdentifiedUser(...)

registerIdentifiedUser(options: { userId?: string; email?: string; }) => Promise<void>
ParamType
options{ userId?: string; email?: string; }

registerUnidentifiedUser()

registerUnidentifiedUser() => Promise<void>

updateUser(...)

updateUser(options: IntercomUserUpdateOptions) => Promise<void>
ParamType
optionsIntercomUserUpdateOptions

logout()

logout() => Promise<void>

logEvent(...)

logEvent(options: { name: string; data?: any; }) => Promise<void>
ParamType
options{ name: string; data?: any; }

displayMessenger()

displayMessenger() => Promise<void>

displayMessageComposer(...)

displayMessageComposer(options: { message: string; }) => Promise<void>
ParamType
options{ message: string; }

displayHelpCenter()

displayHelpCenter() => Promise<void>

hideMessenger()

hideMessenger() => Promise<void>

displayLauncher()

displayLauncher() => Promise<void>

hideLauncher()

hideLauncher() => Promise<void>

displayInAppMessages()

displayInAppMessages() => Promise<void>

hideInAppMessages()

hideInAppMessages() => Promise<void>

displayCarousel(...)

displayCarousel(options: { carouselId: string; }) => Promise<void>
ParamType
options{ carouselId: string; }

setUserHash(...)

setUserHash(options: { hmac: string; }) => Promise<void>
ParamType
options{ hmac: string; }

setUserJwt(...)

setUserJwt(options: { jwt: string; }) => Promise<void>
ParamType
options{ jwt: string; }

setBottomPadding(...)

setBottomPadding(options: { value: string; }) => Promise<void>
ParamType
options{ value: string; }

sendPushTokenToIntercom(...)

sendPushTokenToIntercom(options: { value: string; }) => Promise<void>
ParamType
options{ value: string; }

receivePush(...)

receivePush(notification: IntercomPushNotificationData) => Promise<void>
ParamType
notificationIntercomPushNotificationData

displayArticle(...)

displayArticle(options: { articleId: string; }) => Promise<void>
ParamType
options{ articleId: string; }

addListener('windowDidShow', ...)

addListener(eventName: 'windowDidShow', listenerFunc: () => void) => Promise<PluginListenerHandle>
ParamType
eventName'windowDidShow'
listenerFunc() => void

Returns: Promise<PluginListenerHandle>


addListener('windowDidHide', ...)

addListener(eventName: 'windowDidHide', listenerFunc: () => void) => Promise<PluginListenerHandle>
ParamType
eventName'windowDidHide'
listenerFunc() => void

Returns: Promise<PluginListenerHandle>


removeAllListeners()

removeAllListeners() => Promise<void>

Interfaces

IntercomUserUpdateOptions

PropType
userIdstring
emailstring
namestring
phonestring
languageOverridestring
customAttributes{ [key: string]: any; }

IntercomPushNotificationData

PropType
conversation_idstring
messagestring
bodystring
author_namestring
image_urlstring
app_namestring
receiverstring
conversation_part_typestring
intercom_push_typestring
uristring
push_only_conversation_idstring
instance_idstring
titlestring
prioritynumber

PluginListenerHandle

PropType
remove() => Promise<void>

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);
-        }});
-    }
}

License

MIT

Example

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Stew
Stew

💻 📖
David Seek
David Seek

💻
Roman Nikitin
Roman Nikitin

💻
Anne Tomassoni
Anne Tomassoni

💻 👀
Maciej Modzelewski
Maciej Modzelewski

💻
Oleg Yuzvik
Oleg Yuzvik

🚧
Gustavo Corrêa Alves
Gustavo Corrêa Alves

📖
Jealvia
Jealvia

🚧
Adam Duren
Adam Duren

💻 🚧
Rami Khafagi
Rami Khafagi

💻
Masahiko Sakakibara
Masahiko Sakakibara

🚧
Dejardin Camille
Dejardin Camille

💻
Mohamed Abdelgwad
Mohamed Abdelgwad

🚧
Nathan
Nathan

🚧
Cecil Wöbker
Cecil Wöbker

💻 🚧
Pavlo Pyrig
Pavlo Pyrig

💻
Ruan
Ruan

💻
RickJeroen
RickJeroen

🚧
reslear
reslear

📖
Philipp Matter
Philipp Matter

💻
Josh Pike
Josh Pike

🚧
vtorenaintermedia
vtorenaintermedia

💻

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

版本与发布记录

@capacitor-community/intercom 共发布 27 个版本,首次发布于 2020/06/28;过去 12 个月发布了 2 个版本。

版本发布日期距今
8.0.0latest2026/03/247 个月前
7.2.02025/11/1211 个月前
7.1.02025/08/221.2 年前
7.0.32025/02/071.7 年前
7.0.22025/02/051.8 年前
7.0.12025/02/051.8 年前

其他发布通道:next → 4.0.0-0。

关于 @capacitor-community/intercom 的常见问题

@capacitor-community/intercom 是什么?

Enable Intercom features for Capacitor apps

如何安装 @capacitor-community/intercom?

在项目目录运行 npm install @capacitor-community/intercom,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@capacitor/core(>=8.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@capacitor-community/intercom 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@capacitor-community/intercom 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@capacitor-community/intercom 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@capacitor-community/intercom 可以商用吗?

@capacitor-community/intercom 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@capacitor-community/intercom 的下载量有多少?

根据 npm 官方下载统计,@capacitor-community/intercom 在 2026/10/09 – 2026/11/07 这 30 天内被下载 103,683 次,日均约 3,456 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@capacitor-community/intercom 还在维护吗?

最新版本 8.0.0 发布于 2026/03/24(7 个月前);至今共发布 27 个版本,其中过去 12 个月发布了 2 个;首次发布于 2020/06/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。