开始
复制一个包含安装步骤和本插件的完整Markdown指南的设置命令。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-crisp`
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/crisp/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-crisp` plugin in my project.如果您更喜欢手动设置,请按照以下命令安装插件并遵循以下平台特定的说明:
bun add @capgo/capacitor-crispbunx cap sync导入
标题为“导入”import { CapacitorCrisp } from '@capgo/capacitor-crisp';API概述
标题为“API概述”configure
Section titled “配置”为您的网站 ID 配置 Crisp SDK。 必须在使用任何其他方法之前调用。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.configure({ websiteID: 'YOUR_WEBSITE_ID' });openMessenger
Section titled “打开Messenger”打开 Crisp 消息聊天窗口。 向用户显示聊天界面。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CapacitorCrisp.openMessenger();setTokenID
Section titled “设置TokenID”为当前用户会话设置一个唯一的令牌 ID。 用于识别和恢复之前的会话。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CapacitorCrisp.setTokenID({} as { tokenID: string });setUser
Section titled “设置用户”为当前会话设置用户信息。 更新支持代理可见的用户资料。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.setUser({ nickname: 'John Doe', email: 'john@example.com', phone: '+1234567890'});pushEvent
Section titled “pushEvent”向 Crisp 推送自定义事件。 用于跟踪用户行为和行为。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.pushEvent({ name: 'completed_purchase', color: 'green'});setCompany
Section titled “setCompany”为当前会话设置公司信息。 将用户与 Crisp 中的公司相关联。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.setCompany({ name: 'Acme Corp', url: 'https://acme.com', employment: ['CEO', 'Executive'], geolocation: ['USA', 'San Francisco']});setInt
Section titled “setInt”设置自定义整数数据字段。 存储与用户会话相关的数字数据。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.setInt({ key: 'user_level', value: 42 });setString
Section titled “setString”设置自定义字符串数据字段。 存储与用户会话相关的文本数据。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.setString({ key: 'subscription_tier', value: 'premium' });sendMessage
sendMessage用户发送消息到聊天室。 程序化地发送消息,仿佛用户自己输入的。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.sendMessage({ value: 'Hello, I need help!' });setSegment
setSegment为目标和组织设置用户分段。 用于在 Crisp 控制台中分类用户。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.setSegment({ segment: 'premium-users' });reset
reset重置 Crisp 会话。 清除所有用户数据并开始一个新的会话。 在用户注销时有用。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CapacitorCrisp.reset();类型参考
ConfigureOptionsConfigureOptions
类型参考初始化 Crisp 的配置。
export interface ConfigureOptions { /** * Your Crisp website ID from dashboard. */ websiteID: string; /** * Optional - Locale to force in the Crisp chat widget (ISO 639-1), eg. `en`, `fr`, `es`. * Web + Android: overrides the runtime locale. iOS follows the device/app locale. */ locale?: string; /** * Optional - Unique token identifier for the user session continuity. */ tokenID?: string;}eventColor
事件颜色Crisp 事件的可用颜色。用于在 Crisp 控制台中可视化事件分类。
export type eventColor = | 'red' | 'orange' | 'yellow' | 'green' | 'blue' | 'purple' | 'pink' | 'brown' | 'grey' | 'black';真实来源
真实来源本页面是由插件生成的。重新同步公共 __CAPGO_KEEP_0__ 时,重新运行上游。 src/definitions.ts. Re-run the sync when the public API changes upstream.
继续从 Getting Started
如果您正在使用Available colors for Crisp events. Used to visually categorize events in the Crisp dashboard. 开始使用 为了规划仪表板和API操作,连接它 使用@capgo/capacitor-crisp 在使用@capgo/capacitor-crisp中, API概述 在API概述中了解实现细节 介绍 在介绍中了解实现细节 API密钥 在API密钥中了解实现细节 设备 在设备中了解实现细节