Pembelajaran Dasar
Pengaturan siap dicopy dengan langkah instalasi dan panduan markdown lengkap untuk plugin ini.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-intercom`
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/intercom/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.
Instal
Judul Bagian “Install”Anda dapat menggunakan Pengaturan Asisten AI kami untuk menginstal plugin. Tambahkan Capgo kemampuan ke alat AI Anda menggunakan perintah berikut:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsLalu gunakan prompt berikut:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-intercom` plugin in my project.Jika Anda lebih suka Pengaturan Manual, instal plugin dengan menjalankan perintah-perintah berikut dan ikuti instruksi spesifik platform di bawah:
bun add @capgo/capacitor-intercombunx cap syncImpor
Judul Bagian “Impor”import { CapgoIntercom } from '@capgo/capacitor-intercom';API Pengenalan
Judul Bagian “API Pengenalan”loadWithKeys
Judul Bagian “loadWithKeys”Mulai Intercom dengan API kunci pada waktu runtime. Gunakan ini jika Anda lebih suka tidak mengkonfigurasi kunci di capacitor.config.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.loadWithKeys({} as IntercomLoadOptions);registerIdentifiedUser
Judul Bagian “registerIdentifiedUser”Mendaftarkan pengguna yang dikenal dengan Intercom. Setidaknya salah satu userId atau email harus disediakan.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.registerIdentifiedUser({} as IntercomIdentifiedUserOptions);registerUnidentifiedUser
Judul Bagian “registerUnidentifiedUser”Mendaftarkan pengguna anonim dengan Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.registerUnidentifiedUser();updateUser
Judul Bagian “updateUser”Mengupdate atribut pengguna di Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.updateUser({} as IntercomUserUpdateOptions);logout
Bab berjudul “keluar”Keluar pengguna dari Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.logout();logEvent
Bab berjudul “logEvent”Merekam suatu acara khusus di Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.logEvent({} as IntercomLogEventOptions);displayMessenger
Bab berjudul “displayMessenger”Buka pesan Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayMessenger();displayMessageComposer
Bab berjudul “displayMessageComposer”Terbuka komposer pesan dengan pesan yang sudah diisi sebelumnya.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayMessageComposer({} as IntercomMessageComposerOptions);displayHelpCenter
Bab berjudul “displayHelpCenter”Terbuka pusat bantuan Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayHelpCenter();hideMessenger
Bab berjudul “hideMessenger”Sembunyikan pesan Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.hideMessenger();displayLauncher
Bab berjudul “displayLauncher”Tampilkan tombol peluncur Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayLauncher();hideLauncher
Bab berjudul “hideLauncher”Tutup tombol peluncur Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.hideLauncher();displayInAppMessages
Bagian berjudul “displayInAppMessages”Aktifkan pesan dalam aplikasi dari Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayInAppMessages();hideInAppMessages
Bagian berjudul “hideInAppMessages”Matikan pesan dalam aplikasi dari Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.hideInAppMessages();displayCarousel
Bagian berjudul “displayCarousel”Tampilkan carousel Intercom tertentu.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayCarousel({} as IntercomCarouselOptions);displayArticle
Bagian berjudul “displayArticle”Menggunakan artikel Intercom tertentu.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displayArticle({} as IntercomArticleOptions);displaySurvey
Bab berjudul “displaySurvey”Menggunakan survei Intercom tertentu.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.displaySurvey({} as IntercomSurveyOptions);setUserHash
Bab berjudul “setUserHash”Mengatur HMAC untuk verifikasi identitas.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.setUserHash({} as IntercomUserHashOptions);setUserJwt
Bab berjudul “setUserJwt”Mengatur JWT untuk autentikasi pesan yang aman.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.setUserJwt({} as IntercomUserJwtOptions);setBottomPadding
Bab berjudul “setBottomPadding”Setlah jarak bawah untuk antarmuka pesan Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.setBottomPadding({} as IntercomBottomPaddingOptions);sendPushTokenToIntercom
Bab berjudul “sendPushTokenToIntercom”Kirimkan token notifikasi ke Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.sendPushTokenToIntercom({} as IntercomPushTokenOptions);receivePush
Bab berjudul “receivePush”Proseskan notifikasi push yang diterima dari Intercom.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.receivePush({} as IntercomPushNotificationData);getUnreadConversationCount
Bab berjudul “getUnreadConversationCount”Dapatkan jumlah percakapan yang belum dibaca untuk pengguna saat ini.
import { CapgoIntercom } from '@capgo/capacitor-intercom';
await CapgoIntercom.getUnreadConversationCount();Referensi Tipe
Referensi TipeIntercomLoadOptions
Referensi IntercomLoadOptionsexport interface IntercomLoadOptions { appId?: string; apiKeyIOS?: string; apiKeyAndroid?: string;}IntercomIdentifiedUserOptions
Referensi Pengguna Teridentifikasi Intercomexport interface IntercomIdentifiedUserOptions { userId?: string; email?: string;}IntercomUserUpdateOptions
Referensi Perbarui Pengguna Intercomexport interface IntercomUserUpdateOptions { userId?: string; email?: string; name?: string; phone?: string; languageOverride?: string; customAttributes?: { [key: string]: any }; companies?: IntercomCompany[];}IntercomLogEventOptions
Referensi Log Event Intercomexport interface IntercomLogEventOptions { name: string; data?: { [key: string]: any };}IntercomMessageComposerOptions
Referensi Komposer Pesan Intercomexport interface IntercomMessageComposerOptions { message: string;}IntercomCarouselOptions
Referensi Opsi Karusel Intercomexport interface IntercomCarouselOptions { carouselId: string;}IntercomArticleOptions
Bab berjudul “IntercomArticleOptions”export interface IntercomArticleOptions { articleId: string;}IntercomSurveyOptions
Bab berjudul “IntercomSurveyOptions”export interface IntercomSurveyOptions { surveyId: string;}IntercomUserHashOptions
Bab berjudul “IntercomUserHashOptions”export interface IntercomUserHashOptions { hmac: string;}IntercomUserJwtOptions
Bab berjudul “IntercomUserJwtOptions”export interface IntercomUserJwtOptions { jwt: string;}IntercomBottomPaddingOptions
Bab berjudul “IntercomBottomPaddingOptions”export interface IntercomBottomPaddingOptions { value: number;}IntercomPushTokenOptions
Bab berjudul “IntercomPushTokenOptions”export interface IntercomPushTokenOptions { value: string;}Sumber Kebenaran
Judul Bagian “Sumber Kebenaran”Halaman ini dihasilkan dari plugin’s src/definitions.tsRe-run sinkronisasi ketika API publik berubah di atas
Lanjutkan dari Getting Started
Judul Bagian “Lanjutkan dari Getting Started”Jika Anda menggunakan Getting Started untuk merencanakan dashboard dan API operasi, hubungkannya dengan Menggunakan @capgo/capacitor-intercom untuk kemampuan asli di Menggunakan @capgo/capacitor-intercom, API Pengenalan untuk detail implementasi di API Pengenalan, Pendahuluan untuk detail implementasi di Pendahuluan, API Kunci untuk detail implementasi di API Kunci, dan Perangkat untuk detail implementasi di Perangkat.