npm install @capgo/capacitor-crisp
npx cap sync
Call configure in your code Before any other method :
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
CapacitorCrisp.configure({websiteID: '******-****-****-****-********'})
To enable your users to take and upload photos to the chat as well as download photos to their photo library, add :
Privacy - Camera Usage Description (NSCameraUsageDescription)
Privacy - Photo Library Additions Usage Description (NSPhotoLibraryAddUsageDescription)
to your app's Info.plist.
Nothing special to do.
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
CapacitorCrisp.openMessenger()
configure(data: { websiteID: string; }) => Promise<void>
Param | Type |
---|---|
data |
{ websiteID: string; } |
openMessenger() => Promise<void>
setTokenID(data: { tokenID: string; }) => Promise<void>
Param | Type |
---|---|
data |
{ tokenID: string; } |
setUser(data: { nickname?: string; phone?: string; email?: string; avatar?: string; }) => Promise<void>
Param | Type |
---|---|
data |
{ nickname?: string; phone?: string; email?: string; avatar?: string; } |
pushEvent(data: { name: string; color: eventColor; }) => Promise<void>
Param | Type |
---|---|
data |
{ name: string; color: eventColor; } |
setCompany(data: { name: string; url?: string; description?: string; employment?: [title: string, role: string]; geolocation?: [country: string, city: string]; }) => Promise<void>
Param | Type |
---|---|
data |
{ name: string; url?: string; description?: string; employment?: [title: string, role: string]; geolocation?: [country: string, city: string]; } |
setInt(data: { key: string; value: number; }) => Promise<void>
Param | Type |
---|---|
data |
{ key: string; value: number; } |
setString(data: { key: string; value: string; }) => Promise<void>
Param | Type |
---|---|
data |
{ key: string; value: string; } |
sendMessage(data: { value: string; }) => Promise<void>
Param | Type |
---|---|
data |
{ value: string; } |
setSegment(data: { segment: string; }) => Promise<void>
Param | Type |
---|---|
data |
{ segment: string; } |
reset() => Promise<void>
"red" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "brown" | "grey" | "black"
The @capgo/capacitor-crisp
package allows you to integrate Crisp, a native SDK, into your Capacitor app. It provides methods for configuring Crisp, opening the chatbox, setting user details, sending events, and more.
To get started with the @capgo/capacitor-crisp
package, follow these steps:
npm install @capgo/capacitor-crisp
npx cap sync
Before using any of the methods provided by the @capgo/capacitor-crisp
package, you need to configure Crisp with your website ID. Add the following code to your project:
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
CapacitorCrisp.configure({ websiteID: '******-****-****-****-********' });
Replace '******-****-****-****-********'
with your actual Crisp website ID.
If you're targeting iOS, you need to add the following permissions to your app's Info.plist file:
Make sure to provide a description for each permission explaining why your app needs it.
There are no additional steps required for Android integration.
To open the Crisp chatbox in your app, use the openMessenger
method provided by the @capgo/capacitor-crisp
package. Add the following code to your project:
import { CapacitorCrisp } from '@capgo/capacitor-crisp';
CapacitorCrisp.openMessenger();
This will open the Crisp chatbox for users to start a conversation with your support team.
The @capgo/capacitor-crisp
package provides several other methods for customizing and interacting with Crisp. Here are some of the available methods:
setTokenID
: Set the token ID for the user.setUser
: Set the user's details such as nickname, phone number, email, and avatar.pushEvent
: Send a custom event to Crisp.setCompany
: Set the company details including name, URL, description, employment, and geolocation.setInt
: Set a custom integer value.setString
: Set a custom string value.sendMessage
: Send a chat message to Crisp.setSegment
: Set the segment for the user.reset
: Reset the Crisp configuration.For more information on these methods and their parameters, refer to the official documentation of the @capgo/capacitor-crisp
package.
That's it! You've learned how to use the @capgo/capacitor-crisp
package to integrate Crisp into your Capacitor app. Enjoy seamless communication with your users through the Crisp chatbox.