跳过内容

Getting Started

安装

安装
终端窗口
bun add @capgo/capacitor-intercom
bunx cap sync

导入

导入
import { CapgoIntercom } from '@capgo/capacitor-intercom';

loadWithKeys

使用密钥加载

Initialize Intercom with API keys at runtime. Use this if you prefer not to configure keys in capacitor.config.

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

registerIdentifiedUser

标题:注册已识别用户

使用 Intercom 注册已知用户。 至少需要提供一个用户 ID 或电子邮件。

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

registerUnidentifiedUser

标题:注册未识别用户

使用 Intercom 注册匿名用户。

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

在 Intercom 中更新用户属性。

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

在 Intercom 中注销用户。

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

在Intercom中记录自定义事件。

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

打开Intercom的消息盒子。

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

displayMessageComposer

标题:displayMessageComposer

打开带有预填写消息的消息编辑器。

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

打开Intercom的帮助中心。

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

隐藏Intercom的消息推送器.

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

显示Intercom的启动器按钮.

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

隐藏Intercom的启动器按钮.

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

在Intercom中启用应用内消息。

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

在 Intercom 中禁用应用内消息。

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

在 Intercom 中显示特定的旋转门。

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

displayArticle

标题:显示文章

在 Intercom 中显示特定的文章。

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

在 Intercom 中显示特定的调查。

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

设置身份验证的HMAC哈希值

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

设置安全的消息者认证JWT

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

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

getUnreadConversationCount

标题:获取未读会话数量

获取当前用户的未读会话数量。

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

IntercomLoadOptions

标题:IntercomLoadOptions
export interface IntercomLoadOptions {
appId?: string;
apiKeyIOS?: string;
apiKeyAndroid?: string;
}

IntercomIdentifiedUserOptions

标题:IntercomIdentifiedUserOptions
export interface IntercomIdentifiedUserOptions {
userId?: string;
email?: string;
}

IntercomUserUpdateOptions

《IntercomUserUpdateOptions》部分
export interface IntercomUserUpdateOptions {
userId?: string;
email?: string;
name?: string;
phone?: string;
languageOverride?: string;
customAttributes?: { [key: string]: any };
companies?: IntercomCompany[];
}
export interface IntercomLogEventOptions {
name: string;
data?: { [key: string]: any };
}

IntercomMessageComposerOptions

《IntercomMessageComposerOptions》部分
export interface IntercomMessageComposerOptions {
message: string;
}
export interface IntercomCarouselOptions {
carouselId: string;
}
export interface IntercomArticleOptions {
articleId: string;
}
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 来规划仪表板和 API 操作,请将其连接到 使用 @capgo/capacitor-intercom 为 Using @capgo/capacitor-intercom 中的原生功能 API Overview 为 API Overview 中的实现细节 介绍 为 Introduction 中的实现细节 API 键 用于API 键的实现细节, 设备 用于设备的实现细节,