开始
复制一个包含安装步骤和本插件完整 Markdown 指南的设置提示。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-intercom`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/intercom/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
您可以使用我们的AI辅助设置来安装插件。将Capgo技能添加到您的AI工具中,使用以下命令:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins然后使用以下提示:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-intercom` plugin in my project.如果您prefer手动设置,安装插件并运行以下命令并遵循以下平台特定的说明:
bun add @capgo/capacitor-intercombunx cap syncimport { CapgoIntercom } from '@capgo/capacitor-intercom';API 介绍
标题:API 介绍loadWithKeys
标题:loadWithKeys在运行时使用 API 密钥初始化 Intercom。 如果您不想在 capacitor.config 中配置密钥,请使用此选项。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.loadWithKeys({} as IntercomLoadOptions);registerIdentifiedUser
标题:registerIdentifiedUser使用 Intercom 注册已知用户。 至少需要提供一个 userId 或 email。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.registerIdentifiedUser({} as IntercomIdentifiedUserOptions);registerUnidentifiedUser
标题:registerUnidentifiedUser使用 Intercom 注册匿名用户。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.registerUnidentifiedUser();updateUser
标题:updateUser在 Intercom 中更新用户属性。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.updateUser({} as IntercomUserUpdateOptions);logout
标题:“登出”在 Intercom 中登出用户。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.logout();logEvent
标题:“记录事件”在 Intercom 中记录自定义事件。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.logEvent({} as IntercomLogEventOptions);displayMessenger
标题:“显示消息者”在 Intercom 中打开消息者。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayMessenger();displayMessageComposer
标题:“显示消息编辑器”打开带有预填写消息的消息编辑器。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayMessageComposer({} as IntercomMessageComposerOptions);displayHelpCenter
显示帮助中心打开Intercom帮助中心。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayHelpCenter();hideMessenger
隐藏消息传递器复制到剪贴板
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.hideMessenger();displayLauncher
复制到剪贴板隐藏启动器
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayLauncher();hideLauncher
显示帮助中心隐藏 Intercom 启动器按钮。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.hideLauncher();displayInAppMessages
标题:"displayInAppMessages"启用 Intercom 在应用内消息。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayInAppMessages();hideInAppMessages
标题:"hideInAppMessages"禁用 Intercom 在应用内消息。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.hideInAppMessages();displayCarousel
标题:"displayCarousel"显示特定的 Intercom 轮播。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayCarousel({} as IntercomCarouselOptions);displayArticle
标题:"displayArticle"显示特定 Intercom 文章。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayArticle({} as IntercomArticleOptions);displaySurvey
标题为“显示调查”显示特定 Intercom 调查。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displaySurvey({} as IntercomSurveyOptions);setUserHash
标题为“设置用户哈希”设置身份验证的 HMAC。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.setUserHash({} as IntercomUserHashOptions);setUserJwt
标题为“设置用户 JWT”设置安全消息传递的 JWT。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.setUserJwt({} as IntercomUserJwtOptions);setBottomPadding
标题为“设置底部填充”设置 Intercom 消息 UI 的底部填充。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.setBottomPadding({} as IntercomBottomPaddingOptions);sendPushTokenToIntercom
标题:"sendPushTokenToIntercom"将推送令牌发送到 Intercom。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.sendPushTokenToIntercom({} as IntercomPushTokenOptions);receivePush
标题:"receivePush"处理接收到的 Intercom 推送通知。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.receivePush({} as IntercomPushNotificationData);getUnreadConversationCount
标题:"getUnreadConversationCount"获取当前用户未读对话数。
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.getUnreadConversationCount();类型参考
类型参考IntercomLoadOptions
IntercomLoadOptionsexport interface IntercomLoadOptions { appId?: string; apiKeyIOS?: string; apiKeyAndroid?: string;}IntercomIdentifiedUserOptions
IntercomIdentifiedUserOptionsexport interface IntercomIdentifiedUserOptions { userId?: string; email?: string;}IntercomUserUpdateOptions
IntercomUserUpdateOptionsexport interface IntercomUserUpdateOptions { userId?: string; email?: string; name?: string; phone?: string; languageOverride?: string; customAttributes?: { [key: string]: any }; companies?: IntercomCompany[];}IntercomLogEventOptions
IntercomLogEventOptionsexport interface IntercomLogEventOptions { name: string; data?: { [key: string]: any };}IntercomMessageComposerOptions
IntercomMessageComposerOptionsexport interface IntercomMessageComposerOptions { message: string;}IntercomCarouselOptions
IntercomCarouselOptionsexport interface IntercomCarouselOptions { carouselId: string;}IntercomArticleOptions
标题:IntercomArticleOptionsexport interface IntercomArticleOptions { articleId: string;}IntercomSurveyOptions
标题:IntercomSurveyOptionsexport interface IntercomSurveyOptions { surveyId: string;}IntercomUserHashOptions
标题:IntercomUserHashOptionsexport interface IntercomUserHashOptions { hmac: string;}IntercomUserJwtOptions
标题:IntercomUserJwtOptionsexport interface IntercomUserJwtOptions { jwt: string;}IntercomBottomPaddingOptions
标题:IntercomBottomPaddingOptionsexport interface IntercomBottomPaddingOptions { value: number;}IntercomPushTokenOptions
标题:IntercomPushTokenOptionsexport interface IntercomPushTokenOptions { value: string;}真实数据来源
真实数据来源本页由插件生成 src/definitions.ts当公共 API 在上游发生变化时,请重新同步。
继续从 Getting Started
继续从 Getting Started如果您正在使用 Getting Started 来规划仪表板和 API 操作,请将其连接到 使用 @capgo/capacitor-intercom 使用 @capgo/capacitor-intercom API 介绍 for the implementation detail in API 介绍, 介绍 for the implementation detail in 介绍, API 密钥 for the implementation detail in API 密钥, 和 设备 for the implementation detail in 设备。