コンテンツにジャンプ

ページ/エリア: Capgo マーケティング ウェブサイト。役割: ウェブサイト コピーの文。見られる場所: component doc/SignupCta.astro, component Hero.astro。

GitHub

AIアシストセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。

ターミナルウィンドウ
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';

Intercomを capacitor.config または loadWithKeys() 以下のAPIの前に。

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.loadWithKeys({
appId: 'your-app-id',
apiKeyIOS: 'ios-api-key',
apiKeyAndroid: 'android-api-key',
});
await CapgoIntercom.registerIdentifiedUser({ userId: '42', email: 'user@example.com' });
await CapgoIntercom.displayMessenger();

例:ヘルプセンター記事

例:ヘルプセンター記事
await CapgoIntercom.displayArticle({ articleId: '12345' });

例:未読のアイコン

例:未読のアイコン
await CapgoIntercom.addListener('unreadCountDidChange', ({ count }) => {
setBadge(count);
});

よくある間違い

よくある間違い
  • キー:呼び出し loadWithKeys() または、他のAPIよりもIntercomのキーを設定する。
  • ログアウト: call logout() Web
  • Web__CAPGO_KEEP_0__の概要

セクション「APIの概要」

APIガイド

IntercomをAPIキーで実行時に初期化します。 capacitor.configにキーを設定しない場合はこちらを使用してください。

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.loadWithKeys({
appId: 'app-id-123',
apiKeyIOS: 'api-key-ios',
apiKeyAndroid: 'api-key-android',
});

registerIdentifiedUser

context

Intercomユーザーを登録します。 ユーザーIDまたはメールアドレスのいずれかを入力してください。

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.registerIdentifiedUser({
userId: 'user-id-123',
email: 'user@example.com',
});

registerUnidentifiedUser

未知のユーザーを登録

未知のユーザーを登録

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

ログアウト

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.updateUser({ userId: 'user-id-123' });

未知のユーザーを登録

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

Intercomのカスタムイベントをログに記録します。

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.logEvent({ name: 'example' });

Intercomのメッセンジャーを開きます。

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

メッセージコンポーザーを開き、メッセージを事前に埋め込みます。

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayMessageComposer({ message: 'Hello from Capacitor' });

displayHelpCenter

ヘルプセンター

Intercomのヘルプセンターを開きます。

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

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

インアプリメッセージを有効にする

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

Intercomのインアプリメッセージを無効にします。

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

「表示カレンダー」セクション

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayCarousel({ carouselId: 'carousel-id-123' });

「表示記事」セクション

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayArticle({ articleId: 'article-id-123' });

「表示アンケート」セクション

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displaySurvey({ surveyId: 'survey-id-123' });

ID認証のためのHMACを設定します。

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

ユーザーJWTを設定

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

インター コム メッセンジャー UI の下部パディングを設定

import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.setBottomPadding({ value: 1 });

プッシュ通知を受信

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

受信したIntercomプッシュ通知を処理する。

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

getUnreadConversationCount

クリップボードにコピー

現在のユーザーの未読会話の数を取得する。

import { CapgoIntercom } from '@capgo/capacitor-intercom';
const result = await CapgoIntercom.getUnreadConversationCount();
console.log(result);

「getUnreadConversationCount」セクション

現在のユーザーの未読会話の数を取得する。

IntercomLoadOptions

型の参照
export interface IntercomLoadOptions {
appId?: string;
apiKeyIOS?: string;
apiKeyAndroid?: string;
}

IntercomIdentifiedUserOptions

「型の参照」セクション
export interface IntercomIdentifiedUserOptions {
userId?: string;
email?: string;
}
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 };
}
export interface IntercomMessageComposerOptions {
message: string;
}
export interface IntercomCarouselOptions {
carouselId: string;
}
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 から続けてください

Section titled “Getting Startedから続ける”

Capgoを使用している場合 Getting Started Capgoを使用してダッシュボードとAPIの操作を計画する場合、CapgoをAPIに接続します。 Using @capgo/capacitor-intercom @capgo/capacitor-intercomのネイティブ機能の使用 CapgoのAPIの概要 CapgoのAPIの概要 Capgoの導入 Capgoの導入 CapgoのAPIキー CapgoのAPIキー デバイス デバイスの実装詳細について