跳过内容

Getting Started

GitHub

您可以使用我们的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-intercom
bunx cap sync
import { CapgoIntercom } from '@capgo/capacitor-intercom';

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

将推送令牌发送到Intercom

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.sendPushTokenToIntercom({} as IntercomPushTokenOptions);

处理接收到的Intercom推送通知

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.receivePush({} as IntercomPushNotificationData);

获取当前用户未读对话数

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.getUnreadConversationCount();
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;
}
export interface IntercomSurveyOptions {
surveyId: string;
}
export interface IntercomUserHashOptions {
hmac: string;
}
export interface IntercomUserJwtOptions {
jwt: string;
}
export interface IntercomBottomPaddingOptions {
value: number;
}
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中的实现细节 设备 简介中的实现细节