This is a Singer tap that produces JSON-formatted data following the Singer spec.
This tap:
- Pulls raw data from Zendesk's Chat API
- Extracts the following resources:
- Outputs the schema for each resource
- Incrementally pulls data based on the input state
-
Install
pip install tap-zendesk-chat
-
Get a Zendesk Chat Access Token
You will need to be able to create a token using an OAuth 2 authorization request. To do this locally, you can use Postman.
Once you know how you will authorize (including the redirect URLs for the authorization request), log into your Zendesk Chat / Zopim account, go to
Settings -> Account -> API -> Add API Client
Once you create the API Client you will receive a client ID and client secret. Use these in conjunction with your chose method of performing the OAuth 2 reqeust to obtain an access token to your (or a third-party) Zendesk Chat / Zopim account.
- Create the Config File
Create a JSON file called config.json
containing the access token and a
start_date
, which specifies the date at which the tap will begin pulling data
(for those resources that support this).
{
"start_date": "2010-01-01",
"access_token": "your-access-token"
}
-
Run the Tap in Discovery Mode
tap-zendesk-chat -c config.json -d
See the Singer docs on discovery mode here.
-
Run the Tap in Sync Mode
tap-zendesk-chat -c config.json -p catalog-file.json
You can configure the tap to re-sync all chats every so many number of days.
This is configured with the chats_full_sync_days
option in your config.json
file.
This exists due to the options (or lack thereof) the Zendesk Chat API provides when syncing chats. Each chat has an "end timestamp" that indicates when the chat was "ended." However, even after the chat has ended, it may be modified. In order to not sync all of the chats during every run of the tap, the tap filters data based on the "end timestamp." But this means if the chat is modified after the tap has already synced it, any modifications will be missed by the tap. By re-syncing every N days, you are able to update any chats that may have changed since they were synced by the tap.
In addition to the above oddities around the "end timestamp," the chats resource provides another unique challenge. There are two different types of chats: offline messages and normal chats.
Offline messages do not have the end timestamp property. Instead, they only provide a timestamp when the offline message was created. As a result, the tap syncs offline timestamps based on their timestamp and syncs regular chats based on their end timestamp. This requires storing two separate bookmarks in the tap's "state."
Copyright © 2017 Stitch