killbill-zendesk-plugin
=======================
Plugin to mirror Kill Bill data into Zendesk.
Release builds are available on [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.ning.killbill.ruby%22%20AND%20a%3A%22zendesk-plugin%22) with coordinates `com.ning.killbill.ruby:zendesk-plugin`.
User data mapping
-----------------
Zendesk attribute | Value |
name | Kill Bill account name |
external_id | Kill Bill account external key if specified, Kill Bill account id otherwise |
locale | Kill Bill account locale |
time_zone | Kill Bill account timezone |
email | Kill Bill account email |
phone | Kill Bill account phone |
details | Kill Bill account address1, Kill Bill account address2, Kill Bill account city, Kill Bill account state or province, Kill Bill account postal code, Kill Bill account country |
Usage
-----
The plugin will automcatically listen to all account events (creation or update), and create or update the associated user in Zendesk.
If you need to trigger a refresh manually, the plugin exposes the following endpoint:
```
curl -v \
-d'webrick=stupid' \
-XPUT \
"http://$HOST:8080/plugins/killbill-zendesk/users/"
```
Given a Kill Bill account id or Zendesk user id, you can retrieve the Kill Bill - Zendesk mapping via:
```
curl -v \
"http://$HOST:8080/plugins/killbill-zendesk/users/"
```
Requirements
------------
The plugin needs a database to keep a local mapping between Kill Bill account ids and Zendesk user ids (this is to work around indexing delays in Zendesk). The latest version of the schema can be found here: https://raw.github.com/killbill/killbill-zendesk-plugin/master/db/ddl.sql.
Configuration
-------------
The plugin expects a `zendesk.yml` configuration file containing the following:
```
:zendesk:
:subdomain: 'mysubdomain'
:username: 'email@domain.com'
:password: 'password'
# Alternatively, to use Token Authentication or OAuth
#token: 'kX53RIXZKUFhZxSYhRxe7QGFocTkDmmERDxpcddF'
#access_token: 'kX53RIXZKUFhZxSYhRxe7QGFocTkDmmERDxpcddF'
# Optional
# :retry: true
:database:
:adapter: 'sqlite3'
:database: 'test.db'
# For MySQL
# :adapter: 'jdbc'
# :username: 'your-username'
# :password: 'your-password'
# :driver: 'com.mysql.jdbc.Driver'
# :url: 'jdbc:mysql://127.0.0.1:3306/your-database'
```
By default, the plugin will look at the plugin directory root (where `killbill.properties` is located) to find this file.
Alternatively, set the Kill Bill system property `-Dcom.ning.billing.osgi.bundles.jruby.conf.dir=/my/directory` to specify another location.