No commit activity in last 3 years
No release in over 3 years
fluent Input plugin to collect data from Deskcom.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

>= 0
 Project Readme

Deskcom plugin for Fluentd

Fluentd Input plugin to collect data from Your Deskcom. It is useful to improve your support quality. This plugin is still experimental. This plugin depends on desk library Also, please see Desk API v2

Quick Start

If you want to use fluent-plugin-deskcom on Heroku, you can start easily. Please see the following page, and click Deploy to Heroku button! https://github.com/toru-takahashi/heroku-td-agent

Installation

Add this line to your application's Gemfile:

gem 'fluent-plugin-deskcom'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fluent-plugin-deskcom

Get Desk.com API key

Your Desk.com API key, secret, token and token secret can be found by following this guide:

  1. Log in to your Desk.com admin panel using your personal URL (http://your-account.desk.com/admin).
  2. Click on Settings: step2
  3. From the left menu select API > My Applications.
  4. If you don’t already have an application defined for TreasureData, create one by clicking on the “Add API Application” button and enter the following information: step4-1 step4-2
  5. Find your Key and Secret codes for the TreasureData API application: step5
  6. Find your Token and Token secret by clicking on the Your Access Token link: step6

Usage

The followings are examples of fluentd.conf(td-agent.conf)

Cases Config Sample

<source>
  type                deskcom
  subdomain           DESKCOM_SUBDOMAIN           # Required (<subdomain>.desk.com)
  consumer_key        DESKCOM_CONSUMER_KEY        # Required
  consumer_secret     DESKCOM_CONSUMER_SECRET     # Required
  oauth_token         DESKCOM_OAUTH_TOKEN         # Required
  oauth_token_secret  DESKCOM_OAUTH_TOKEN_SECRET  # Required
  store_file          /var/log/cases.yml          # Optional (filepath)
  output_format       simple                      # Optional (simple(default))
  input_api           cases                       # Optional (cases(default) or replies)
  tag                 deskcom.cases               # Required
  time_format         updated_at                  # Optional
</source>
{
    "id": 150,
    "blurb": ": "",
    "priority": 4,
    "external_id": null,
    "locked_until": null,
    "label_ids": [],
    "active_at": null,
    "changed_at": "2013-02-10T14:18:56Z",
    "created_at": "2013-01-15T11:12:20Z",
    "updated_at": "2013-02-10T14:18:56Z",
    "first_opened_at": null,
    "opened_at": null,
    "first_resolved_at": "2013-01-27T13:54:13Z",
    "resolved_at": "2013-01-27T13:54:13Z",
    "status": "closed",
    "description": null,
    "language": null,
    "received_at": "2013-01-15T11:12:20Z",
    "type": "email",
    "labels": [],
    "subject": "Chat transcript: no operator and Japan #6642",
    "custom_fields": "{\"custom1_\":null,\"custom2_\":null}"
}

Replies Config Sample

<source>
  type                deskcom
  subdomain           DESKCOM_SUBDOMAIN           # Required (<subdomain>.desk.com)
  consumer_key        DESKCOM_CONSUMER_KEY        # Required
  consumer_secret     DESKCOM_CONSUMER_SECRET     # Required
  oauth_token         DESKCOM_OAUTH_TOKEN         # Required
  oauth_token_secret  DESKCOM_OAUTH_TOKEN_SECRET  # Required
  store_file          /var/log/replies.yml          # Optional (filepath)
  output_format       simple                      # Optional (simple(default))
  input_api           replies                     # Optional (cases(default) or replies)
  tag                 deskcom.replies               # Required
</source>
{
    "case_id": 1
    "id": 159057281,
    "created_at": "2013-01-14T22:18:14Z",
    "updated_at": "2013-01-14T22:18:14Z",
    "sent_at": null,
    "erased_at": null,
    "hidden_by": null,
    "hidden_at": null,
    "body": "",
    "from": "Toru Takahashi <torutakahashi.ayashi@gmail.com>",
    "to": "\"test user\" <test@user.co.jp>",
    "cc": "",
    "bcc": null,
    "client_type": "apple_mail",
    "direction": "in",
    "status": "received",
    "subject": "subject",
    "hidden": false
}

Config Sample (Deskcom -> TreasureData)

# fluent.conf
<source>
  type                deskcom
  subdomain           DESKCOM_SUBDOMAIN           # Required (<subdomain>.desk.com)
  consumer_key        DESKCOM_CONSUMER_KEY        # Required
  consumer_secret     DESKCOM_CONSUMER_SECRET     # Required
  oauth_token         DESKCOM_OAUTH_TOKEN         # Required
  oauth_token_secret  DESKCOM_OAUTH_TOKEN_SECRET  # Required
  store_file          /var/log/cases.yml          # Optional (filepath)
  output_format       simple                      # Optional (simple(default))
  input_api           cases                       # Optional (cases(default) or replies)
  tag                 deskcom.cases               # Required
  time_column         updated_at
</source>

<source>
  type                deskcom
  subdomain           DESKCOM_SUBDOMAIN           # Required (<subdomain>.desk.com)
  consumer_key        DESKCOM_CONSUMER_KEY        # Required
  consumer_secret     DESKCOM_CONSUMER_SECRET     # Required
  oauth_token         DESKCOM_OAUTH_TOKEN         # Required
  oauth_token_secret  DESKCOM_OAUTH_TOKEN_SECRET  # Required
  store_file          /var/log/replies.yml        # Optional (filepath)
  output_format       simple                      # Optional (simple(default))
  input_api           replies                     # Optional (cases(default) or replies)
  tag                 deskcom.replies             # Required
  time_column         created_at
</source>

<match **>
  type tdlog
  apikey TREASUREDATA_API_KEY

  auto_create_table
  buffer_path /var/log/td-agent/tdlog
</match>

TO DO

  • Allows over 2 input_api (Ex. input_api cases,replies)
  • Add other input_api
  • Add Rate Limits
  • Add feature to remind last collect cases or replies when forced termination.

Copyright

Copyright (c) 2014 Toru Takahashi

License

MIT License