capacitor-zendesk-chat
v1.0.0-beta.4
Published
Zendesk Chat plugin for Capacitor
Downloads
17
Maintainers
Readme
Capacitor Zendesk Chat plugin
/!\ The plugin only works for android
and ios
platform. /!\
Installation
npm i capacitor-zendesk-chat
Configuration
Configure plugin
Add your key on capacitor.json
and sync it with npx cap sync
.
{
"plugins": {
"ZendeskChat": {
"accountKey": "your-zendesk-account--key"
}
}
}
Register plugin
Find the init component of your app and register the web plugin.
import { registerWebPlugin } from "@capacitor/core";
import { ZendeskChat } from 'capacitor-zendesk-chat';
registerWebPlugin(ZendeskChat);
Use it
import { Plugins } from '@capacitor/core';
const { ZendeskChat } = Plugins;
// Initialize the plugin
ZendeskChat.initialize();
// Add Visitor info if needed
ZendeskChat.setVisitorInfo({
name: "John Doe",
email: "[email protected]",
phoneNumber: "+33 1 23 45 67 89"
})
// Open chat
ZendeskChat.open({
tags: ["tag1", "tag2"], // You can add tags
department: "department" // You can specify a department
});
Platform: Web/PWA
The plugin is not available on web
platform.
Platform: Android
Import the Zendesk Chat library in build.gradle
...
// Note that this is root level repositories container and not the one under 'buildScript'
repositories {
maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
}
...
dependencies {
compile group: 'com.zopim.android', name: 'sdk-api', version: '1.4.2'
}
...
Register the plugin in com.companyname.appname.MainActivity#onCreate
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
...
add(ZendeskChat.class); // Add ZendeskChat Plugin
}});
}
Platform: iOS
On iOS the plugin is registered automatically by Capacitor.