malua / capacitor-zendesk-chat

Zendesk Chat plugin for Capacitor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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: "john@doe.com",
  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.

About

Zendesk Chat plugin for Capacitor


Languages

Language:Java 29.4%Language:Swift 21.1%Language:Ruby 16.8%Language:TypeScript 14.6%Language:Objective-C 14.0%Language:JavaScript 4.1%