Getting Started
复制一个包含安装步骤和本插件的完整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.如果您更喜欢手动设置,请按照以下命令安装插件并遵循以下平台特定的说明:
bun add @capgo/capacitor-intercombunx cap sync导入
导入部分import { 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注册已知用户。 至少需要提供一个用户ID或电子邮件地址。
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
事件复制到剪贴板
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.logEvent({} as IntercomLogEventOptions);displayMessenger
复制到剪贴板消息
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
隐藏消息中心隐藏Intercom消息中心
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.hideMessenger();displayLauncher
显示启动器显示Intercom启动器按钮
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
displaySurvey显示特定Intercom调查
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displaySurvey({} as IntercomSurveyOptions);setUserHash
setUserHash设置身份验证的HMAC
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.setUserHash({} as IntercomUserHashOptions);setUserJwt
setUserJwt设置安全消息者认证的JWT
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.setUserJwt({} as IntercomUserJwtOptions);setBottomPadding
setBottomPadding设置Intercom消息者UI的底部填充
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.setBottomPadding({} as IntercomBottomPaddingOptions);sendPushTokenToIntercom
Section titled “sendPushTokenToIntercom”将推送令牌发送到Intercom
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.sendPushTokenToIntercom({} as IntercomPushTokenOptions);receivePush
Section titled “receivePush”处理接收到的Intercom推送通知
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.receivePush({} as IntercomPushNotificationData);getUnreadConversationCount
Section titled “getUnreadConversationCount”获取当前用户未读对话数
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.getUnreadConversationCount();IntercomLoadOptions
Section titled “IntercomLoadOptions”export interface IntercomLoadOptions { appId?: string; apiKeyIOS?: string; apiKeyAndroid?: string;}IntercomIdentifiedUserOptions
标题:已识别用户选项export interface IntercomIdentifiedUserOptions { userId?: string; email?: string;}IntercomUserUpdateOptions
标题:用户更新选项export interface IntercomUserUpdateOptions { userId?: string; email?: string; name?: string; phone?: string; languageOverride?: string; customAttributes?: { [key: string]: any }; companies?: IntercomCompany[];}IntercomLogEventOptions
标题:日志事件选项export interface IntercomLogEventOptions { name: string; data?: { [key: string]: any };}IntercomMessageComposerOptions
标题:消息组合器选项export interface IntercomMessageComposerOptions { message: string;}IntercomCarouselOptions
标题:轮播选项export interface IntercomCarouselOptions { carouselId: string;}IntercomArticleOptions
标题:文章选项export interface IntercomArticleOptions { articleId: string;}IntercomSurveyOptions
名为“IntercomSurveyOptions”的部分export interface IntercomSurveyOptions { surveyId: string;}IntercomUserHashOptions
名为“IntercomUserHashOptions”的部分export interface IntercomUserHashOptions { hmac: string;}IntercomUserJwtOptions
名为“IntercomUserJwtOptions”的部分export interface IntercomUserJwtOptions { jwt: string;}IntercomBottomPaddingOptions
名为“IntercomBottomPaddingOptions”的部分export interface IntercomBottomPaddingOptions { value: number;}IntercomPushTokenOptions
名为“IntercomPushTokenOptions”的部分export interface IntercomPushTokenOptions { value: string;}真实数据来源
“数据源”本页面由插件生成 src/definitions.ts. 当公共 API 上游更改时,请重新运行同步
从 Getting Started 开始
“从 Getting Started 开始”如果您正在使用 Getting Started 来规划仪表板和 API 操作,请将其与 使用 @capgo/capacitor-intercom 为使用 @capgo/capacitor-intercom 的本机功能 API 概述 为 API 概述 的实现细节 简介 简介中的实现细节 API Keys API Keys中的实现细节 设备 简介中的实现细节