Crisp native SDK for capacitor
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; }) => any
Param | Type |
---|---|
data |
{ websiteID: string; } |
Returns: any
openMessenger() => any
Returns: any
setTokenID(data: { tokenID: string; }) => any
Param | Type |
---|---|
data |
{ tokenID: string; } |
Returns: any
setUser(data: { nickname?: string; phone?: string; email?: string; avatar?: string; }) => any
Param | Type |
---|---|
data |
{ nickname?: string; phone?: string; email?: string; avatar?: string; } |
Returns: any
pushEvent(data: { name: string; color: eventColor; }) => any
Param | Type |
---|---|
data |
{ name: string; color: eventColor; } |
Returns: any
setCompany(data: { name: string; url?: string; description?: string; employment?: [title: string, role: string]; geolocation?: [country: string, city: string]; }) => any
Param | Type |
---|---|
data |
{ name: string; url?: string; description?: string; employment?: [title: string, role: string]; geolocation?: [country: string, city: string]; } |
Returns: any
setInt(data: { key: string; value: number; }) => any
Param | Type |
---|---|
data |
{ key: string; value: number; } |
Returns: any
setString(data: { key: string; value: string; }) => any
Param | Type |
---|---|
data |
{ key: string; value: string; } |
Returns: any
sendMessage(data: { value: string; }) => any
Param | Type |
---|---|
data |
{ value: string; } |
Returns: any
setSegment(data: { segment: string; }) => any
Param | Type |
---|---|
data |
{ segment: string; } |
Returns: any
reset() => any
Returns: any
"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.