Getting Started
このプラグインのインストール手順と完全なマークダウンガイドが含まれるセットアップ用の質問をコピーする。
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.
Install
インストールbun add @capgo/capacitor-crispbunx cap syncImport
インポートimport { CapacitorCrisp } from '@capgo/capacitor-crisp';APIの概要
APIの概要configure
__CAPGO_KEEP_0__の設定SDKを使用する前に、ウェブサイトIDでCrispを設定する必要があります。コピー
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.configure({ websiteID: 'YOUR_WEBSITE_ID' });openMessenger
openMessengerCrispのメッセンジャーチャットウィンドウを開きます。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CapacitorCrisp.openMessenger();setTokenID
クリップボードにコピーsetTokenID
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CapacitorCrisp.setTokenID({} as { tokenID: string });setUser
前回の会話を識別して復元するために使用されます。クリップボードにコピー
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.setUser({ nickname: 'John Doe', email: 'john@example.com', phone: '+1234567890'});pushEvent
現在のセッションのユーザー情報を設定します。サポートエージェントに表示されるユーザープロフィールを更新します。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.pushEvent({ name: 'completed_purchase', color: 'green'});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
セクション「setInt」カスタム整数データフィールドを設定します。ユーザーセッションに関連付けられた数値データを保存します。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.setInt({ key: 'user_level', value: 42 });setString
セクション「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
セグメントを設定ユーザーをターゲットにし、組織化するためにユーザー セグメントを設定します。 Crisp ダッシュボードでユーザーをカテゴリ化するために使用されます。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CrispPlugin.setSegment({ segment: 'premium-users' });reset
セクション「リセット」ログアウトしたときにユーザー データをクリアし、新しいセッションを開始するためにCrisp セッションをリセットします。 ユーザー データをすべてクリアします。
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
await CapacitorCrisp.reset();タイプ リファレンス
セクション「タイプ リファレンス」ConfigureOptions
セクション「設定オプション」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';真実の源
「真実の源」というセクションこのページはプラグインの src/definitions.tsから生成されます。 . upstream のパブリック API が変更された場合に再度 Sync を実行してください。
Getting Started から続けてください
「Getting Started から続けてください」というセクションあなたが Getting Started を使用してダッシュボードと API の作業計画を立てている場合、 @capgo/capacitor-crisp を接続してください。 @capgo/capacitor-crispのネイティブ機能について APIの概要 @API/__CAPGO_KEEP_1__-crispの実装詳細について 導入 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-crispの実装詳細について @API/__CAPGO_KEEP_1__-crispのキーについて for the implementation detail in API Keys, and @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-crispの実装詳細について ページを編集