1
0
mirror of synced 2025-12-25 02:09:19 -05:00

🎉 New Source: Zendesk Chat (#3088)

* Zendesk Chat connector: implement full_refresh sync

* format

* Source Zendesk Chat: Implement Incremental sync (#3157)

* Zendesk Chat: Implement Incremental sync

* Roll back the stream Chats to the previous endpoint

* update integration-base-python to v0.1.6

* update limit to 100

* add acceptence tests

* update test and setup configs

* remove unknown file

* update naming of classes

Co-authored-by: ykurochkin <y.kurochkin@zazmic.com>
Co-authored-by: Eugene Kulak <kulak.eugene@gmail.com>

* register Zendesk Chat as source

Co-authored-by: ykurochkin <y.kurochkin@zazmic.com>
Co-authored-by: Eugene Kulak <kulak.eugene@gmail.com>
This commit is contained in:
Yevhenii
2021-05-03 23:02:00 +03:00
committed by GitHub
parent c512a7ed83
commit 6bc63264e7
41 changed files with 2623 additions and 0 deletions

View File

@@ -84,6 +84,7 @@ jobs:
STRIPE_INTEGRATION_TEST_CREDS: ${{ secrets.STRIPE_INTEGRATION_TEST_CREDS }}
TEMPO_INTEGRATION_TEST_CREDS: ${{ secrets.TEMPO_INTEGRATION_TEST_CREDS }}
TWILIO_TEST_CREDS: ${{ secrets.TWILIO_TEST_CREDS }}
ZENDESK_CHAT_INTEGRATION_TEST_CREDS: ${{ secrets.ZENDESK_CHAT_INTEGRATION_TEST_CREDS }}
ZENDESK_SECRETS_CREDS: ${{ secrets.ZENDESK_SECRETS_CREDS }}
ZENDESK_TALK_TEST_CREDS: ${{ secrets.ZENDESK_TALK_TEST_CREDS }}
ZOOM_INTEGRATION_TEST_CREDS: ${{ secrets.ZOOM_INTEGRATION_TEST_CREDS }}

View File

@@ -84,6 +84,7 @@ jobs:
STRIPE_INTEGRATION_TEST_CREDS: ${{ secrets.STRIPE_INTEGRATION_TEST_CREDS }}
TEMPO_INTEGRATION_TEST_CREDS: ${{ secrets.TEMPO_INTEGRATION_TEST_CREDS }}
TWILIO_TEST_CREDS: ${{ secrets.TWILIO_TEST_CREDS }}
ZENDESK_CHAT_INTEGRATION_TEST_CREDS: ${{ secrets.ZENDESK_CHAT_INTEGRATION_TEST_CREDS }}
ZENDESK_SECRETS_CREDS: ${{ secrets.ZENDESK_SECRETS_CREDS }}
ZENDESK_TALK_TEST_CREDS: ${{ secrets.ZENDESK_TALK_TEST_CREDS }}
ZOOM_INTEGRATION_TEST_CREDS: ${{ secrets.ZOOM_INTEGRATION_TEST_CREDS }}

View File

@@ -0,0 +1,8 @@
{
"sourceDefinitionId": "40d24d0f-b8f9-4fe0-9e6c-b06c0f3f45e4",
"name": "Zendesk Chat",
"dockerRepository": "airbyte/source-zendesk-chat",
"dockerImageTag": "0.1.0",
"documentationUrl": "https://hub.docker.com/r/airbyte/source-zendesk-chat",
"icon": "zendesk.svg"
}

View File

@@ -148,6 +148,12 @@
dockerImageTag: 0.2.2
documentationUrl: https://https://docs.airbyte.io/integrations/sources/greenhouse
icon: greenhouse.svg
- sourceDefinitionId: 40d24d0f-b8f9-4fe0-9e6c-b06c0f3f45e4
name: Zendesk Chat
dockerRepository: airbyte/source-zendesk-chat
dockerImageTag: 0.1.0
documentationUrl: https://hub.docker.com/r/airbyte/source-zendesk-chat
icon: zendesk.svg
- sourceDefinitionId: d29764f8-80d7-4dd7-acbe-1a42005ee5aa
name: Zendesk Support
dockerRepository: airbyte/source-zendesk-support-singer

View File

@@ -0,0 +1,6 @@
*
!Dockerfile
!Dockerfile.test
!source_zendesk_chat
!setup.py
!secrets

View File

@@ -0,0 +1 @@
NEW_SOURCE_CHECKLIST.md

View File

@@ -0,0 +1,16 @@
FROM airbyte/integration-base-python:0.1.6
# Bash is installed for more convenient debugging.
RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/*
ENV CODE_PATH="source_zendesk_chat"
ENV AIRBYTE_IMPL_MODULE="source_zendesk_chat"
ENV AIRBYTE_IMPL_PATH="SourceZendeskChat"
WORKDIR /airbyte/integration_code
COPY $CODE_PATH ./$CODE_PATH
COPY setup.py ./
RUN pip install .
LABEL io.airbyte.version=0.1.0
LABEL io.airbyte.name=airbyte/source-zendesk-chat

View File

@@ -0,0 +1,98 @@
# Zendesk Chat Source
This is the repository for the Zendesk Chat source connector, written in Python.
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/zendesk-chat).
## Local development
### Prerequisites
**To iterate on this connector, make sure to complete this prerequisites section.**
#### Build & Activate Virtual Environment and install dependencies
From this connector directory, create a virtual environment:
```
python -m venv .venv
```
This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
development environment of choice. To activate it from the terminal, run:
```
source .venv/bin/activate
pip install -r requirements.txt
```
If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
should work as you expect.
#### Building via Gradle
From the Airbyte repository root, run:
```
./gradlew :airbyte-integrations:connectors:source-zendesk-chat:build
```
#### Create credentials
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/zendesk-chat)
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_zendesk_chat/spec.json` file.
Note that the `secrets` directory is gitignored by default, so there is no danger of accidentally checking in sensitive information.
See `sample_files/sample_config.json` for a sample config file.
**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source zendesk-chat test creds`
and place them into `secrets/config.json`.
### Locally running the connector
```
python main_dev.py spec
python main_dev.py check --config secrets/config.json
python main_dev.py discover --config secrets/config.json
python main_dev.py read --config secrets/config.json --catalog sample_files/configured_catalog.json
```
### Unit Tests
To run unit tests locally, from the connector directory run:
```
python -m pytest unit_tests
```
### Locally running the connector docker image
#### Build
First, make sure you build the latest Docker image:
```
docker build . -t airbyte/source-zendesk-chat:dev
```
You can also build the connector image via Gradle:
```
./gradlew :airbyte-integrations:connectors:source-zendesk-chat:airbyteDocker
```
When building via Gradle, the docker image name and tag, respectively, are the values of the `io.airbyte.name` and `io.airbyte.version` `LABEL`s in
the Dockerfile.
#### Run
Then run any of the connector commands as follows:
```
docker run --rm airbyte/source-zendesk-chat:dev spec
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-zendesk-chat:dev check --config /secrets/config.json
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-zendesk-chat:dev discover --config /secrets/config.json
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/sample_files:/sample_files airbyte/source-zendesk-chat:dev read --config /secrets/config.json --catalog /sample_files/configured_catalog.json
```
### Integration Tests
1. From the airbyte project root, run `./gradlew :airbyte-integrations:connectors:source-zendesk-chat:integrationTest` to run the standard integration test suite.
1. To run additional integration tests, place your integration tests in a new directory `integration_tests` and run them with `python -m pytest -s integration_tests`.
Make sure to familiarize yourself with [pytest test discovery](https://docs.pytest.org/en/latest/goodpractices.html#test-discovery) to know how your test files and methods should be named.
## Dependency Management
All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
### Publishing a new version of the connector
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
1. Make sure your changes are passing unit and integration tests
1. Bump the connector version in `Dockerfile` -- just increment the value of the `LABEL io.airbyte.version` appropriately (we use SemVer).
1. Create a Pull Request
1. Pat yourself on the back for being an awesome contributor
1. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master

View File

@@ -0,0 +1,27 @@
connector_image: airbyte/source-zendesk-chat:dev
tests:
spec:
- spec_path: "source_zendesk_chat/spec.json"
connection:
- config_path: "secrets/config.json"
status: "succeed"
- config_path: "integration_tests/invalid_config.json"
status: "failed"
discovery:
- config_path: "secrets/config.json"
basic_read:
- config_path: "secrets/config.json"
configured_catalog_path: "sample_files/configured_catalog.json"
validate_output_from_all_streams: yes
incremental:
- config_path: "secrets/config.json"
configured_catalog_path: "sample_files/configured_catalog.json"
# Unable to use 'state_path' because Zendesk Chat API returns an error when specifying a date in the future.
# state_path: "integration_tests/abnormal_state.json"
cursor_paths:
agents: ["id"]
bans: ["id"]
agent_timeline: [ "start_time" ]
full_refresh:
- config_path: "secrets/config.json"
configured_catalog_path: "sample_files/configured_catalog.json"

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
docker run --rm -i airbyte/source-acceptance-test \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp:/tmp \
-v ./:/test_input \
--acceptance-test-config /test_input

View File

@@ -0,0 +1,14 @@
plugins {
id 'airbyte-python'
id 'airbyte-docker'
id 'airbyte-source-acceptance-test'
}
airbytePython {
moduleDirectory 'source_zendesk_chat'
}
dependencies {
implementation files(project(':airbyte-integrations:bases:source-acceptance-test').airbyteDocker.outputs)
implementation files(project(':airbyte-integrations:bases:base-python').airbyteDocker.outputs)
}

View File

@@ -0,0 +1,34 @@
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import pytest
pytest_plugins = ("source_acceptance_test.plugin",)
@pytest.fixture(scope="session", autouse=True)
def connector_setup():
"""This fixture is a placeholder for external resources that acceptance test might require."""
# TODO: setup test dependencies
yield
# TODO: clean up test dependencies

View File

@@ -0,0 +1,6 @@
{
"credentials": {
"access_token": "wrongkey-access-token",
"start_date": "2020-12-12T00:00:00Z"
}
}

View File

@@ -0,0 +1,31 @@
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import sys
from base_python.entrypoint import launch
from source_zendesk_chat import SourceZendeskChat
if __name__ == "__main__":
source = SourceZendeskChat()
launch(source, sys.argv[1:])

View File

@@ -0,0 +1,5 @@
# This file is autogenerated -- only edit if you know what you are doing. Use setup.py for declaring dependencies.
-e ../../bases/airbyte-protocol
-e ../../bases/base-python
-e ../../bases/source-acceptance-test
-e .

View File

@@ -0,0 +1,956 @@
{
"streams": [
{
"stream": {
"name": "agents",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"create_date": {
"format": "date-time",
"type": ["null", "string"]
},
"departments": {
"items": {
"type": ["integer"]
},
"type": ["null", "array"]
},
"display_name": {
"type": ["null", "string"]
},
"email": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"enabled_departments": {
"type": ["null", "array"]
},
"first_name": {
"type": ["null", "string"]
},
"id": {
"type": ["integer"]
},
"last_login": {
"format": "date-time",
"type": ["null", "string"]
},
"last_name": {
"type": ["null", "string"]
},
"login_count": {
"type": ["null", "integer"]
},
"role_id": {
"type": ["null", "integer"]
},
"roles": {
"properties": {
"administrator": {
"type": ["boolean"]
},
"owner": {
"type": ["boolean"]
}
},
"type": ["null", "object"]
},
"scope": {
"type": ["null", "string"]
},
"skills": {
"items": {
"type": "integer"
},
"type": ["null", "array"]
}
}
},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["id"]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["id"]
},
{
"stream": {
"name": "agent_timeline",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"agent_id": {
"type": ["null", "integer"]
},
"duration": {
"type": ["null", "number"]
},
"engagement_count": {
"type": ["null", "integer"]
},
"start_time": {
"type": ["null", "string"],
"format": "date-time"
},
"status": {
"type": ["null", "string"]
}
}
},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["start_time"]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["start_time"]
},
{
"stream": {
"name": "accounts",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"account_key": {
"type": ["null", "string"]
},
"billing": {
"properties": {
"additional_info": {
"type": ["null", "string"]
},
"address1": {
"type": ["null", "string"]
},
"address2": {
"type": ["null", "string"]
},
"city": {
"type": ["null", "string"]
},
"company": {
"type": ["null", "string"]
},
"country_code": {
"type": ["null", "string"]
},
"cycle": {
"type": ["null", "integer"]
},
"email": {
"type": ["null", "string"]
},
"first_name": {
"type": ["null", "string"]
},
"last_name": {
"type": ["null", "string"]
},
"phone": {
"type": ["null", "string"]
},
"postal_code": {
"type": ["null", "string"]
},
"state": {
"type": ["null", "string"]
}
},
"type": ["null", "object"]
},
"create_date": {
"format": "date-time",
"type": ["null", "string"]
},
"plan": {
"properties": {
"agent_leaderboard": {
"type": ["null", "boolean"]
},
"agent_reports": {
"type": ["null", "boolean"]
},
"analytics": {
"type": ["null", "boolean"]
},
"chat_reports": {
"type": ["null", "boolean"]
},
"daily_reports": {
"type": ["null", "boolean"]
},
"email_reports": {
"type": ["null", "boolean"]
},
"file_upload": {
"type": ["null", "boolean"]
},
"goals": {
"type": ["null", "integer"]
},
"high_load": {
"type": ["null", "boolean"]
},
"integrations": {
"type": ["null", "boolean"]
},
"ip_restriction": {
"type": ["null", "boolean"]
},
"long_desc": {
"type": ["null", "string"]
},
"max_advanced_triggers": {
"type": ["null", "string"]
},
"max_agents": {
"type": ["null", "integer"]
},
"max_basic_triggers": {
"type": ["null", "string"]
},
"max_concurrent_chats": {
"type": ["null", "string"]
},
"max_departments": {
"type": ["null", "string"]
},
"max_history_search_days": {
"type": ["null", "string"]
},
"monitoring": {
"type": ["null", "boolean"]
},
"name": {
"type": ["null", "string"]
},
"operating_hours": {
"type": ["null", "boolean"]
},
"price": {
"minimum": -1e33,
"maximum": 1e33,
"type": ["null", "number"]
},
"rest_api": {
"type": ["null", "boolean"]
},
"short_desc": {
"type": ["null", "string"]
},
"sla": {
"type": ["null", "boolean"]
},
"support": {
"type": ["null", "boolean"]
},
"unbranding": {
"type": ["null", "boolean"]
},
"widget_customization": {
"type": ["null", "string"]
}
},
"type": ["null", "object"]
},
"status": {
"type": ["null", "string"]
}
}
},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "chats",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"agent_ids": {
"items": {
"type": ["string"]
},
"type": ["null", "array"]
},
"agent_names": {
"items": {
"type": ["string"]
},
"type": ["null", "array"]
},
"comment": {
"type": ["null", "string"]
},
"conversions": {
"items": {
"properties": {
"id": {
"type": ["string"]
},
"goal_name": {
"type": ["null", "string"]
},
"goal_id": {
"type": ["null", "integer"]
},
"attribution": {
"properties": {
"chat_timestamp": {
"format": "date-time",
"type": ["null", "string"]
},
"department_name": {
"type": ["null", "string"]
},
"agent_name": {
"type": ["null", "string"]
},
"department_id": {
"type": ["null", "integer"]
},
"agent_id": {
"type": ["null", "integer"]
}
},
"type": ["null", "object"]
},
"timestamp": {
"format": "date-time",
"type": ["null", "string"]
}
},
"type": ["null", "object"],
"additionalProperties": true
},
"type": ["null", "array"]
},
"count": {
"properties": {
"total": {
"type": ["null", "integer"]
},
"agent": {
"type": ["null", "integer"]
},
"visitor": {
"type": ["null", "integer"]
}
},
"type": ["null", "object"],
"additionalProperties": false
},
"department_id": {
"type": ["null", "integer"]
},
"department_name": {
"type": ["null", "string"]
},
"duration": {
"type": ["null", "integer"]
},
"history": {
"items": {
"properties": {
"name": {
"type": ["null", "string"]
},
"channel": {
"type": ["null", "string"]
},
"conversion": {
"properties": {
"id": {
"type": ["string"]
},
"goal_name": {
"type": ["null", "string"]
},
"goal_id": {
"type": ["null", "integer"]
},
"attribution": {
"properties": {
"chat_timestamp": {
"format": "date-time",
"type": ["null", "string"]
},
"department_name": {
"type": ["null", "string"]
},
"agent_name": {
"type": ["null", "string"]
},
"department_id": {
"type": ["null", "integer"]
},
"agent_id": {
"type": ["null", "integer"]
}
},
"type": ["null", "object"]
},
"timestamp": {
"format": "date-time",
"type": ["null", "string"]
}
},
"type": ["null", "object"],
"additionalProperties": true
},
"timestamp": {
"format": "date-time",
"type": ["null", "string"]
},
"msg": {
"type": ["null", "string"]
},
"nick": {
"type": ["null", "string"]
},
"type": {
"type": ["null", "string"]
},
"options": {
"type": ["null", "string"]
},
"department_id": {
"type": ["null", "integer", "string"]
},
"prev_department_id": {
"type": ["null", "integer", "string"]
},
"department_name": {
"type": ["null", "string"]
},
"msg_id": {
"type": ["null", "string", "integer"]
},
"tags": {
"type": ["null", "array"]
},
"new_tags": {
"type": ["null", "array"]
},
"rating": {
"type": ["null", "string"]
},
"new_rating": {
"type": ["null", "string"]
},
"skills_name": {
"type": ["null", "array"]
}
},
"type": ["null", "object"],
"additionalProperties": true
},
"type": ["null", "array"]
},
"id": {
"type": ["null", "string"]
},
"missed": {
"type": ["null", "boolean"]
},
"rating": {
"type": ["null", "string"]
},
"response_time": {
"properties": {
"first": {
"type": ["null", "integer"]
},
"max": {
"type": ["null", "integer"]
},
"avg": {
"type": ["null", "number", "integer"]
}
},
"type": ["null", "object"],
"additionalProperties": false
},
"session": {
"type": ["null", "object"],
"additionalProperties": true
},
"started_by": {
"type": ["null", "string"]
},
"tags": {
"items": {
"type": ["string"]
},
"type": ["null", "array"]
},
"timestamp": {
"format": "date-time",
"type": ["null", "string"]
},
"triggered": {
"type": ["null", "boolean"]
},
"triggered_response": {
"type": ["null", "boolean"]
},
"type": {
"type": ["null", "string"]
},
"unread": {
"type": ["null", "boolean", "integer"]
},
"visitor": {
"properties": {
"name": {
"type": ["null", "string"]
},
"id": {
"type": ["string"]
},
"email": {
"type": ["null", "string"]
},
"notes": {
"type": ["null", "string"]
},
"phone": {
"type": ["null", "string"]
}
},
"type": ["null", "object"],
"additionalProperties": false
},
"webpath": {
"items": {
"properties": {
"to": {
"type": ["null", "string"]
},
"title": {
"type": ["null", "string"]
},
"from": {
"type": ["null", "string"]
},
"timestamp": {
"format": "date-time",
"type": ["null", "string"]
}
},
"type": ["null", "object"],
"additionalProperties": false
},
"type": ["null", "array"]
},
"message": {
"type": ["null", "string"]
},
"zendesk_ticket_id": {
"type": ["null", "integer"]
}
}
},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "shortcuts",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"tags": {
"items": {
"type": ["string"]
},
"type": ["null", "array"]
},
"name": {
"type": ["string"]
},
"options": {
"type": ["null", "string"]
},
"message": {
"type": ["null", "string"]
},
"scope": {
"type": ["null", "string"]
},
"id": {
"type": ["null", "string"]
},
"departments": {
"items": {
"type": "integer"
},
"type": ["null", "array"]
}
}
},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "triggers",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"description": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"id": {
"type": ["integer"]
},
"name": {
"type": ["null", "string"]
},
"definition": {
"properties": {
"actions": {
"type": ["null", "string", "array"]
},
"condition": {
"type": ["null", "string", "array"]
},
"event": {
"type": ["null", "string", "array"]
},
"version": {
"type": ["null", "integer"]
}
},
"type": ["null", "object"]
}
}
},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "bans",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"create_date": {
"format": "date-time",
"type": ["null", "string"]
},
"id": {
"type": ["integer"]
},
"ip_address": {
"type": ["null", "string"]
},
"reason": {
"type": ["null", "string"]
},
"type": {
"type": ["null", "string"]
},
"visitor_id": {
"type": ["null", "string"]
},
"visitor_name": {
"type": ["null", "string"]
}
}
},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["id"]
},
"sync_mode": "incremental",
"destination_sync_mode": "append",
"cursor_field": ["id"]
},
{
"stream": {
"name": "departments",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"description": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"id": {
"type": ["integer"]
},
"members": {
"items": {
"type": ["null", "integer"]
},
"type": ["null", "array"]
},
"name": {
"type": ["null", "string"]
},
"settings": {
"type": ["null", "object"],
"additionalProperties": true
}
}
},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "goals",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"attribution_model": {
"type": ["null", "string"]
},
"attribution_period": {
"type": ["null", "integer"]
},
"description": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"id": {
"type": ["integer"]
},
"name": {
"type": ["null", "string"]
},
"settings": {
"properties": {
"conditions": {
"items": {
"properties": {
"operator": {
"type": ["null", "string"]
},
"type": {
"type": ["null", "string"]
},
"value": {
"type": ["null", "string"]
}
},
"type": ["null", "object"]
},
"type": ["null", "array"]
}
},
"type": ["null", "object"],
"additionalProperties": true
}
}
},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "skills",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"description": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"id": {
"type": ["integer"]
},
"members": {
"items": {
"type": "integer"
},
"type": ["null", "array"]
},
"name": {
"type": ["null", "string"]
}
}
},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "roles",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"description": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"id": {
"type": ["integer"]
},
"members_count": {
"type": ["integer"]
},
"name": {
"type": ["null", "string"]
},
"permissions": {
"type": ["null", "object"],
"properties": {
"visitors_seen": {
"type": ["null", "string"]
},
"proactive_chatting": {
"type": ["null", "string"]
},
"edit_visitor_information": {
"type": ["null", "boolean"]
},
"edit_visitor_notes": {
"type": ["null", "boolean"]
},
"view_past_chats": {
"type": ["null", "string"]
},
"edit_chat_tags": {
"type": ["null", "boolean"]
},
"manage_bans": {
"type": ["null", "string"]
},
"access_analytics": {
"type": ["null", "string"]
},
"view_monitor": {
"type": ["null", "string"]
},
"edit_department_agents": {
"type": ["null", "string"]
},
"set_agent_chat_limit": {
"type": ["null", "string"]
},
"manage_shortcuts": {
"type": ["null", "string"]
}
}
}
}
},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "routing_settings",
"json_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"routing_mode": {
"type": ["null", "string"]
},
"chat_limit": {
"type": ["null", "object"],
"properties": {
"enabled": {
"type": ["null", "boolean"]
},
"limit": {
"type": ["null", "integer"]
},
"limit_type": {
"type": ["null", "string"]
},
"allow_agent_override": {
"type": ["null", "boolean"]
}
}
},
"skill_routing": {
"type": ["null", "object"],
"properties": {
"enabled": {
"type": ["null", "boolean"]
},
"max_wait_time": {
"type": ["null", "integer"]
}
}
},
"reassignment": {
"type": ["null", "object"],
"properties": {
"enabled": {
"type": ["null", "boolean"]
},
"timeout": {
"type": ["null", "integer"]
}
}
},
"auto_idle": {
"type": ["null", "object"],
"properties": {
"enabled": {
"type": ["null", "boolean"]
},
"reassignments_before_idle": {
"type": ["null", "integer"]
},
"new_status": {
"type": ["null", "string"]
}
}
}
}
},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
}
]
}

View File

@@ -0,0 +1,4 @@
{
"access_token": "<your_access_token>",
"start_date": "2020-11-01T00:00:00"
}

View File

@@ -0,0 +1,46 @@
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from setuptools import find_packages, setup
MAIN_REQUIREMENTS = [
"airbyte-protocol",
"base-python",
"pendulum==1.2.0",
"requests==2.25.1",
]
TEST_REQUIREMENTS = ["pytest==6.1.2", "source-acceptance-test"]
setup(
name="source_zendesk_chat",
description="Source implementation for Zendesk Chat.",
author="Airbyte",
author_email="contact@airbyte.io",
packages=find_packages(),
install_requires=MAIN_REQUIREMENTS,
package_data={"": ["*.json", "schemas/*.json"]},
extras_require={
"tests": TEST_REQUIREMENTS,
},
)

View File

@@ -0,0 +1,25 @@
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from .source import SourceZendeskChat
__all__ = ["SourceZendeskChat"]

View File

@@ -0,0 +1,262 @@
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from abc import ABC, abstractmethod
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Union
import pendulum
import requests
from base_python import HttpStream
class Stream(HttpStream):
url_base = "https://www.zopim.com/api/v2/"
data_field = None
limit = 100
def backoff_time(self, response: requests.Response) -> Optional[float]:
delay_time = response.headers.get("Retry-After")
if delay_time:
return int(delay_time)
def path(self, **kwargs) -> str:
return self.name
def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
return {}
def request_params(
self, stream_state: Mapping[str, Any], next_page_token: Mapping[str, Any] = None, **kwargs
) -> MutableMapping[str, Any]:
params = {"limit": self.limit}
if next_page_token:
params.update(next_page_token)
return params
def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]:
response_data = response.json()
stream_data = self.get_stream_data(response_data)
yield from stream_data
def get_stream_data(self, response_data: Any) -> List[dict]:
if self.data_field:
response_data = response_data.get(self.data_field, [])
if isinstance(response_data, list):
return response_data
elif isinstance(response_data, dict):
return [response_data]
else:
raise Exception(f"Unsupported type of response data for stream {self.name}")
class BaseIncrementalStream(Stream, ABC):
@property
@abstractmethod
def cursor_field(self) -> str:
"""
Defining a cursor field indicates that a stream is incremental, so any incremental stream must extend this class
and define a cursor field.
"""
@abstractmethod
def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, Any]:
"""
Return the latest state by comparing the cursor value in the latest record with the stream's most recent state object
and returning an updated state object.
"""
@staticmethod
def _field_to_datetime(value: Union[int, str]) -> pendulum.datetime:
if isinstance(value, int):
value = pendulum.from_timestamp(value / 1000.0)
elif isinstance(value, str):
value = pendulum.parse(value)
else:
raise ValueError(f"Unsupported type of datetime field {type(value)}")
return value
class TimeIncrementalStream(BaseIncrementalStream, ABC):
def __init__(self, start_date, **kwargs):
super().__init__(**kwargs)
self._start_date = pendulum.parse(start_date)
def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
response_data = response.json()
if response_data["count"] == self.limit:
return {"start_time": response_data["end_time"]}
def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, Any]:
latest_benchmark = self._field_to_datetime(latest_record[self.cursor_field])
if current_stream_state.get(self.cursor_field):
return {self.cursor_field: str(max(latest_benchmark, self._field_to_datetime(current_stream_state[self.cursor_field])))}
return {self.cursor_field: str(latest_benchmark)}
def request_params(
self, stream_state: Mapping[str, Any], next_page_token: Mapping[str, Any] = None, **kwargs
) -> MutableMapping[str, Any]:
params = super().request_params(stream_state=stream_state, next_page_token=next_page_token)
if next_page_token:
params.update(next_page_token)
else:
start_datetime = self._start_date
if stream_state.get(self.cursor_field):
start_datetime = pendulum.parse(stream_state[self.cursor_field])
params.update({"start_time": int(start_datetime.timestamp())})
params.update({"fields": f"{self.name}(*)"})
return params
def path(self, **kwargs) -> str:
return f"incremental/{self.name}"
class IdIncrementalStream(BaseIncrementalStream):
cursor_field = "id"
def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, Any]:
latest_benchmark = latest_record[self.cursor_field]
if current_stream_state.get(self.cursor_field):
return {self.cursor_field: max(latest_benchmark, current_stream_state[self.cursor_field])}
return {self.cursor_field: latest_benchmark}
def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
stream_data = self.get_stream_data(response.json())
if len(stream_data) == self.limit:
last_object_id = stream_data[-1]["id"]
return {"since_id": last_object_id}
def request_params(
self, stream_state: Mapping[str, Any], next_page_token: Mapping[str, Any] = None, **kwargs
) -> MutableMapping[str, Any]:
params = super().request_params(stream_state=stream_state, next_page_token=next_page_token)
if next_page_token:
params.update(next_page_token)
elif stream_state.get(self.cursor_field):
params.update({"since_id": stream_state[self.cursor_field]})
return params
class Agents(IdIncrementalStream):
"""
Agents Stream: https://developer.zendesk.com/rest_api/docs/chat/agents#list-agents
"""
class AgentTimelines(TimeIncrementalStream):
"""
Agent Timelines Stream: https://developer.zendesk.com/rest_api/docs/chat/incremental_export#incremental-agent-timeline-export
"""
cursor_field = "start_time"
data_field = "agent_timeline"
name = "agent_timeline"
def request_params(self, **kwargs) -> MutableMapping[str, Any]:
params = super().request_params(**kwargs)
if not kwargs.get("next_page_token"):
params["start_time"] = params["start_time"] * 1000000
return params
class Accounts(Stream):
"""
Accounts Stream: https://developer.zendesk.com/rest_api/docs/chat/accounts#show-account
"""
def path(self, **kwargs) -> str:
return "account"
class Chats(Stream):
"""
Chats Stream: https://developer.zendesk.com/rest_api/docs/chat/chats#list-chats
"""
data_field = "chats"
class Shortcuts(Stream):
"""
Shortcuts Stream: https://developer.zendesk.com/rest_api/docs/chat/shortcuts#list-shortcuts
"""
class Triggers(Stream):
"""
Triggers Stream: https://developer.zendesk.com/rest_api/docs/chat/triggers#list-triggers
"""
class Bans(IdIncrementalStream):
"""
Bans Stream: https://developer.zendesk.com/rest_api/docs/chat/bans#list-bans
"""
def get_stream_data(self, response_data) -> List[dict]:
bans = response_data["ip_address"] + response_data["visitor"]
bans = sorted(bans, key=lambda x: pendulum.parse(x["created_at"]))
return bans
class Departments(Stream):
"""
Departments Stream: https://developer.zendesk.com/rest_api/docs/chat/departments#list-departments
"""
class Goals(Stream):
"""
Goals Stream: https://developer.zendesk.com/rest_api/docs/chat/goals#list-goals
"""
class Skills(Stream):
"""
Skills Stream: https://developer.zendesk.com/rest_api/docs/chat/skills#list-skills
"""
class Roles(Stream):
"""
Roles Stream: https://developer.zendesk.com/rest_api/docs/chat/roles#list-roles
"""
class RoutingSettings(Stream):
"""
Routing Settings Stream: https://developer.zendesk.com/rest_api/docs/chat/routing_settings#show-account-routing-settings
"""
name = "routing_settings"
data_field = "data"
def path(self, **kwargs) -> str:
return "routing_settings/account"

View File

@@ -0,0 +1,151 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"account_key": {
"type": ["null", "string"]
},
"billing": {
"properties": {
"additional_info": {
"type": ["null", "string"]
},
"address1": {
"type": ["null", "string"]
},
"address2": {
"type": ["null", "string"]
},
"city": {
"type": ["null", "string"]
},
"company": {
"type": ["null", "string"]
},
"country_code": {
"type": ["null", "string"]
},
"cycle": {
"type": ["null", "integer"]
},
"email": {
"type": ["null", "string"]
},
"first_name": {
"type": ["null", "string"]
},
"last_name": {
"type": ["null", "string"]
},
"phone": {
"type": ["null", "string"]
},
"postal_code": {
"type": ["null", "string"]
},
"state": {
"type": ["null", "string"]
}
},
"type": ["null", "object"]
},
"create_date": {
"format": "date-time",
"type": ["null", "string"]
},
"plan": {
"properties": {
"agent_leaderboard": {
"type": ["null", "boolean"]
},
"agent_reports": {
"type": ["null", "boolean"]
},
"analytics": {
"type": ["null", "boolean"]
},
"chat_reports": {
"type": ["null", "boolean"]
},
"daily_reports": {
"type": ["null", "boolean"]
},
"email_reports": {
"type": ["null", "boolean"]
},
"file_upload": {
"type": ["null", "boolean"]
},
"goals": {
"type": ["null", "integer"]
},
"high_load": {
"type": ["null", "boolean"]
},
"integrations": {
"type": ["null", "boolean"]
},
"ip_restriction": {
"type": ["null", "boolean"]
},
"long_desc": {
"type": ["null", "string"]
},
"max_advanced_triggers": {
"type": ["null", "string"]
},
"max_agents": {
"type": ["null", "integer"]
},
"max_basic_triggers": {
"type": ["null", "string"]
},
"max_concurrent_chats": {
"type": ["null", "string"]
},
"max_departments": {
"type": ["null", "string"]
},
"max_history_search_days": {
"type": ["null", "string"]
},
"monitoring": {
"type": ["null", "boolean"]
},
"name": {
"type": ["null", "string"]
},
"operating_hours": {
"type": ["null", "boolean"]
},
"price": {
"minimum": -1e33,
"maximum": 1e33,
"type": ["null", "number"]
},
"rest_api": {
"type": ["null", "boolean"]
},
"short_desc": {
"type": ["null", "string"]
},
"sla": {
"type": ["null", "boolean"]
},
"support": {
"type": ["null", "boolean"]
},
"unbranding": {
"type": ["null", "boolean"]
},
"widget_customization": {
"type": ["null", "string"]
}
},
"type": ["null", "object"]
},
"status": {
"type": ["null", "string"]
}
}
}

View File

@@ -0,0 +1,22 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"agent_id": {
"type": ["null", "integer"]
},
"duration": {
"type": ["null", "number"]
},
"engagement_count": {
"type": ["null", "integer"]
},
"start_time": {
"type": ["null", "string"],
"format": "date-time"
},
"status": {
"type": ["null", "string"]
}
}
}

View File

@@ -0,0 +1,67 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"create_date": {
"format": "date-time",
"type": ["null", "string"]
},
"departments": {
"items": {
"type": ["integer"]
},
"type": ["null", "array"]
},
"display_name": {
"type": ["null", "string"]
},
"email": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"enabled_departments": {
"type": ["null", "array"]
},
"first_name": {
"type": ["null", "string"]
},
"id": {
"type": ["integer"]
},
"last_login": {
"format": "date-time",
"type": ["null", "string"]
},
"last_name": {
"type": ["null", "string"]
},
"login_count": {
"type": ["null", "integer"]
},
"role_id": {
"type": ["null", "integer"]
},
"roles": {
"properties": {
"administrator": {
"type": ["boolean"]
},
"owner": {
"type": ["boolean"]
}
},
"type": ["null", "object"]
},
"scope": {
"type": ["null", "string"]
},
"skills": {
"items": {
"type": "integer"
},
"type": ["null", "array"]
}
}
}

View File

@@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"create_date": {
"format": "date-time",
"type": ["null", "string"]
},
"id": {
"type": ["integer"]
},
"ip_address": {
"type": ["null", "string"]
},
"reason": {
"type": ["null", "string"]
},
"type": {
"type": ["null", "string"]
},
"visitor_id": {
"type": ["null", "string"]
},
"visitor_name": {
"type": ["null", "string"]
}
}
}

View File

@@ -0,0 +1,288 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"agent_ids": {
"items": {
"type": ["string"]
},
"type": ["null", "array"]
},
"agent_names": {
"items": {
"type": ["string"]
},
"type": ["null", "array"]
},
"comment": {
"type": ["null", "string"]
},
"conversions": {
"items": {
"properties": {
"id": {
"type": ["string"]
},
"goal_name": {
"type": ["null", "string"]
},
"goal_id": {
"type": ["null", "integer"]
},
"attribution": {
"properties": {
"chat_timestamp": {
"format": "date-time",
"type": ["null", "string"]
},
"department_name": {
"type": ["null", "string"]
},
"agent_name": {
"type": ["null", "string"]
},
"department_id": {
"type": ["null", "integer"]
},
"agent_id": {
"type": ["null", "integer"]
}
},
"type": ["null", "object"]
},
"timestamp": {
"format": "date-time",
"type": ["null", "string"]
}
},
"type": ["null", "object"],
"additionalProperties": true
},
"type": ["null", "array"]
},
"count": {
"properties": {
"total": {
"type": ["null", "integer"]
},
"agent": {
"type": ["null", "integer"]
},
"visitor": {
"type": ["null", "integer"]
}
},
"type": ["null", "object"],
"additionalProperties": false
},
"department_id": {
"type": ["null", "integer"]
},
"department_name": {
"type": ["null", "string"]
},
"duration": {
"type": ["null", "integer"]
},
"history": {
"items": {
"properties": {
"name": {
"type": ["null", "string"]
},
"channel": {
"type": ["null", "string"]
},
"conversion": {
"properties": {
"id": {
"type": ["string"]
},
"goal_name": {
"type": ["null", "string"]
},
"goal_id": {
"type": ["null", "integer"]
},
"attribution": {
"properties": {
"chat_timestamp": {
"format": "date-time",
"type": ["null", "string"]
},
"department_name": {
"type": ["null", "string"]
},
"agent_name": {
"type": ["null", "string"]
},
"department_id": {
"type": ["null", "integer"]
},
"agent_id": {
"type": ["null", "integer"]
}
},
"type": ["null", "object"]
},
"timestamp": {
"format": "date-time",
"type": ["null", "string"]
}
},
"type": ["null", "object"],
"additionalProperties": true
},
"timestamp": {
"format": "date-time",
"type": ["null", "string"]
},
"msg": {
"type": ["null", "string"]
},
"nick": {
"type": ["null", "string"]
},
"type": {
"type": ["null", "string"]
},
"options": {
"type": ["null", "string"]
},
"department_id": {
"type": ["null", "integer", "string"]
},
"prev_department_id": {
"type": ["null", "integer", "string"]
},
"department_name": {
"type": ["null", "string"]
},
"msg_id": {
"type": ["null", "string", "integer"]
},
"tags": {
"type": ["null", "array"]
},
"new_tags": {
"type": ["null", "array"]
},
"rating": {
"type": ["null", "string"]
},
"new_rating": {
"type": ["null", "string"]
},
"skills_name": {
"type": ["null", "array"]
}
},
"type": ["null", "object"],
"additionalProperties": true
},
"type": ["null", "array"]
},
"id": {
"type": ["null", "string"]
},
"missed": {
"type": ["null", "boolean"]
},
"rating": {
"type": ["null", "string"]
},
"response_time": {
"properties": {
"first": {
"type": ["null", "integer"]
},
"max": {
"type": ["null", "integer"]
},
"avg": {
"type": ["null", "number", "integer"]
}
},
"type": ["null", "object"],
"additionalProperties": false
},
"session": {
"type": ["null", "object"],
"additionalProperties": true
},
"started_by": {
"type": ["null", "string"]
},
"tags": {
"items": {
"type": ["string"]
},
"type": ["null", "array"]
},
"timestamp": {
"format": "date-time",
"type": ["null", "string"]
},
"triggered": {
"type": ["null", "boolean"]
},
"triggered_response": {
"type": ["null", "boolean"]
},
"type": {
"type": ["null", "string"]
},
"unread": {
"type": ["null", "boolean", "integer"]
},
"visitor": {
"properties": {
"name": {
"type": ["null", "string"]
},
"id": {
"type": ["string"]
},
"email": {
"type": ["null", "string"]
},
"notes": {
"type": ["null", "string"]
},
"phone": {
"type": ["null", "string"]
}
},
"type": ["null", "object"],
"additionalProperties": false
},
"webpath": {
"items": {
"properties": {
"to": {
"type": ["null", "string"]
},
"title": {
"type": ["null", "string"]
},
"from": {
"type": ["null", "string"]
},
"timestamp": {
"format": "date-time",
"type": ["null", "string"]
}
},
"type": ["null", "object"],
"additionalProperties": false
},
"type": ["null", "array"]
},
"message": {
"type": ["null", "string"]
},
"zendesk_ticket_id": {
"type": ["null", "integer"]
}
}
}

View File

@@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"description": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"id": {
"type": ["integer"]
},
"members": {
"items": {
"type": ["null", "integer"]
},
"type": ["null", "array"]
},
"name": {
"type": ["null", "string"]
},
"settings": {
"type": ["null", "object"],
"additionalProperties": true
}
}
}

View File

@@ -0,0 +1,47 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"attribution_model": {
"type": ["null", "string"]
},
"attribution_period": {
"type": ["null", "integer"]
},
"description": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"id": {
"type": ["integer"]
},
"name": {
"type": ["null", "string"]
},
"settings": {
"properties": {
"conditions": {
"items": {
"properties": {
"operator": {
"type": ["null", "string"]
},
"type": {
"type": ["null", "string"]
},
"value": {
"type": ["null", "string"]
}
},
"type": ["null", "object"]
},
"type": ["null", "array"]
}
},
"type": ["null", "object"],
"additionalProperties": true
}
}
}

View File

@@ -0,0 +1,62 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"description": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"id": {
"type": ["integer"]
},
"members_count": {
"type": ["integer"]
},
"name": {
"type": ["null", "string"]
},
"permissions": {
"type": ["null", "object"],
"properties": {
"visitors_seen": {
"type": ["null", "string"]
},
"proactive_chatting": {
"type": ["null", "string"]
},
"edit_visitor_information": {
"type": ["null", "boolean"]
},
"edit_visitor_notes": {
"type": ["null", "boolean"]
},
"view_past_chats": {
"type": ["null", "string"]
},
"edit_chat_tags": {
"type": ["null", "boolean"]
},
"manage_bans": {
"type": ["null", "string"]
},
"access_analytics": {
"type": ["null", "string"]
},
"view_monitor": {
"type": ["null", "string"]
},
"edit_department_agents": {
"type": ["null", "string"]
},
"set_agent_chat_limit": {
"type": ["null", "string"]
},
"manage_shortcuts": {
"type": ["null", "string"]
}
}
}
}
}

View File

@@ -0,0 +1,62 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"routing_mode": {
"type": ["null", "string"]
},
"chat_limit": {
"type": ["null", "object"],
"properties": {
"enabled": {
"type": ["null", "boolean"]
},
"limit": {
"type": ["null", "integer"]
},
"limit_type": {
"type": ["null", "string"]
},
"allow_agent_override": {
"type": ["null", "boolean"]
}
}
},
"skill_routing": {
"type": ["null", "object"],
"properties": {
"enabled": {
"type": ["null", "boolean"]
},
"max_wait_time": {
"type": ["null", "integer"]
}
}
},
"reassignment": {
"type": ["null", "object"],
"properties": {
"enabled": {
"type": ["null", "boolean"]
},
"timeout": {
"type": ["null", "integer"]
}
}
},
"auto_idle": {
"type": ["null", "object"],
"properties": {
"enabled": {
"type": ["null", "boolean"]
},
"reassignments_before_idle": {
"type": ["null", "integer"]
},
"new_status": {
"type": ["null", "string"]
}
}
}
}
}

View File

@@ -0,0 +1,33 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"tags": {
"items": {
"type": ["string"]
},
"type": ["null", "array"]
},
"name": {
"type": ["string"]
},
"options": {
"type": ["null", "string"]
},
"message": {
"type": ["null", "string"]
},
"scope": {
"type": ["null", "string"]
},
"id": {
"type": ["null", "string"]
},
"departments": {
"items": {
"type": "integer"
},
"type": ["null", "array"]
}
}
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"description": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"id": {
"type": ["integer"]
},
"members": {
"items": {
"type": "integer"
},
"type": ["null", "array"]
},
"name": {
"type": ["null", "string"]
}
}
}

View File

@@ -0,0 +1,35 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"description": {
"type": ["null", "string"]
},
"enabled": {
"type": ["null", "boolean"]
},
"id": {
"type": ["integer"]
},
"name": {
"type": ["null", "string"]
},
"definition": {
"properties": {
"actions": {
"type": ["null", "string", "array"]
},
"condition": {
"type": ["null", "string", "array"]
},
"event": {
"type": ["null", "string", "array"]
},
"version": {
"type": ["null", "integer"]
}
},
"type": ["null", "object"]
}
}
}

View File

@@ -0,0 +1,30 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"created": {
"type": ["null", "integer"]
},
"banned": {
"type": ["boolean", "null"]
},
"email": {
"type": ["null", "string"]
},
"external_id": {
"type": ["null", "string"]
},
"id": {
"type": ["null", "string"]
},
"name": {
"type": ["null", "string"]
},
"notes": {
"type": ["null", "string"]
},
"phone": {
"type": ["null", "string"]
}
}
}

View File

@@ -0,0 +1,56 @@
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from typing import Any, List, Mapping, Tuple
from airbyte_protocol import SyncMode
from base_python import AbstractSource, Stream, TokenAuthenticator
from .api import Accounts, Agents, AgentTimelines, Bans, Chats, Departments, Goals, Roles, RoutingSettings, Shortcuts, Skills, Triggers
class SourceZendeskChat(AbstractSource):
def check_connection(self, logger, config) -> Tuple[bool, any]:
try:
authenticator = TokenAuthenticator(token=config["access_token"])
list(RoutingSettings(authenticator=authenticator).read_records(SyncMode.full_refresh))
return True, None
except Exception as error:
return False, f"Unable to connect to Zendesk Chat API with the provided credentials - {error}"
def streams(self, config: Mapping[str, Any]) -> List[Stream]:
authenticator = TokenAuthenticator(token=config["access_token"])
return [
Agents(authenticator=authenticator),
AgentTimelines(authenticator=authenticator, start_date=config["start_date"]),
Accounts(authenticator=authenticator),
Chats(authenticator=authenticator),
Shortcuts(authenticator=authenticator),
Triggers(authenticator=authenticator),
Bans(authenticator=authenticator),
Departments(authenticator=authenticator),
Goals(authenticator=authenticator),
Skills(authenticator=authenticator),
Roles(authenticator=authenticator),
RoutingSettings(authenticator=authenticator),
]

View File

@@ -0,0 +1,23 @@
{
"documentationUrl": "https://docs.airbyte.io/integrations/sources/zendesk-chat",
"connectionSpecification": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Zendesk Chat Spec",
"type": "object",
"required": ["start_date", "access_token"],
"additionalProperties": false,
"properties": {
"start_date": {
"type": "string",
"description": "The date from which you'd like to replicate data for Zendesk Chat API, in the format YYYY-MM-DDT00:00:00Z.",
"examples": ["2021-02-01T00:00:00Z"],
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
},
"access_token": {
"type": "string",
"description": "The value of the Access Token generated. See the <a href=\"https://docs.airbyte.io/integrations/sources/zendesk-chat\">docs</a> for more information",
"airbyte_secret": true
}
}
}
}

View File

@@ -0,0 +1,52 @@
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""
MIT License
Copyright (c) 2020 Airbyte
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
# format anchor
def test_example_method():
assert True

View File

@@ -73,6 +73,7 @@
* [Smartsheets](integrations/sources/smartsheets.md)
* [Stripe](integrations/sources/stripe.md)
* [Twilio](integrations/sources/twilio.md)
* [Zendesk Chat](integrations/sources/zendesk-chat.md)
* [Zendesk Support](integrations/sources/zendesk-support.md)
* [Zendesk Talk](integrations/sources/zendesk-talk.md)
* [Zoom](integrations/sources/zoom.md)

View File

@@ -62,6 +62,7 @@ Clicking on a status will take you to a summary of past tests that link to the G
| Stripe | [![source-stripe-singer](https://img.shields.io/endpoint?url=https%3A%2F%2Fstatus-api.airbyte.io%2Ftests%2Fsummary%2Fsource-stripe-singer%2Fbadge.json)](https://status-api.airbyte.io/tests/summary/source-stripe-singer) | ✅ | |
| Tempo | [![source-tempo](https://img.shields.io/endpoint?url=https%3A%2F%2Fstatus-api.airbyte.io%2Ftests%2Fsummary%2Fsource-tempo%2Fbadge.json)](https://status-api.airbyte.io/tests/summary/source-tempo) | | |
| Twilio | [![source-twilio-singer](https://img.shields.io/endpoint?url=https%3A%2F%2Fstatus-api.airbyte.io%2Ftests%2Fsummary%2Fsource-twilio-singer%2Fbadge.json)](https://status-api.airbyte.io/tests/summary/source-tempo) | | |
| Zendesk Chat | [![source-zendesk-chat](https://img.shields.io/endpoint?url=https%3A%2F%2Fstatus-api.airbyte.io%2Ftests%2Fsummary%2Fsource-zendesk-chat%2Fbadge.json)](https://status-api.airbyte.io/tests/summary/source-zendesk-chat) | | |
| Zendesk Support | [![source-zendesk-support-singer](https://img.shields.io/endpoint?url=https%3A%2F%2Fstatus-api.airbyte.io%2Ftests%2Fsummary%2Fsource-zendesk-support-singer%2Fbadge.json)](https://status-api.airbyte.io/tests/summary/source-zendesk-support-singer) | | \*\*\*\* |
| Zendesk Talk | [![source-zendesk-talk](https://img.shields.io/endpoint?url=https%3A%2F%2Fstatus-api.airbyte.io%2Ftests%2Fsummary%2Fsource-zendesk-talk%2Fbadge.json)](https://status-api.airbyte.io/tests/summary/source-zendesk-talk) | | |
| Zoom | [![source-zoom-singer](https://img.shields.io/endpoint?url=https%3A%2F%2Fstatus-api.airbyte.io%2Ftests%2Fsummary%2Fsource-zoom-singer%2Fbadge.json)](https://status-api.airbyte.io/tests/summary/source-zoom-singer) | | |

View File

@@ -0,0 +1,59 @@
# Zendesk Chat
## Sync overview
The Zendesk Chat source supports Full Refresh and Incremental syncs.
This source can sync data for the [Zendesk Chat API](https://developer.zendesk.com/rest_api/docs/chat/introduction).
### Output schema
This Source is capable of syncing the following core Streams:
* [Accounts](https://developer.zendesk.com/rest_api/docs/chat/accounts#show-account)
* [Agents](https://developer.zendesk.com/rest_api/docs/chat/agents#list-agents) (Incremental)
* [Agent Timelines](https://developer.zendesk.com/rest_api/docs/chat/incremental_export#incremental-agent-timeline-export) (Incremental)
* [Chats](https://developer.zendesk.com/rest_api/docs/chat/chats#list-chats)
* [Shortcuts](https://developer.zendesk.com/rest_api/docs/chat/shortcuts#list-shortcuts)
* [Triggers](https://developer.zendesk.com/rest_api/docs/chat/triggers#list-triggers)
* [Bans](https://developer.zendesk.com/rest_api/docs/chat/bans#list-bans) (Incremental)
* [Departments](https://developer.zendesk.com/rest_api/docs/chat/departments#list-departments)
* [Goals](https://developer.zendesk.com/rest_api/docs/chat/goals#list-goals)
* [Skills](https://developer.zendesk.com/rest_api/docs/chat/skills#list-skills)
* [Roles](https://developer.zendesk.com/rest_api/docs/chat/roles#list-roles)
* [Routing Settings](https://developer.zendesk.com/rest_api/docs/chat/routing_settings#show-account-routing-settings)
### Data type mapping
| Integration Type | Airbyte Type | Notes |
| :--- | :--- | :--- |
| `string` | `string` | |
| `number` | `number` | |
| `array` | `array` | |
| `object` | `object` | |
### Features
| Feature | Supported?\(Yes/No\) | Notes |
| :--- | :--- | :--- |
| Full Refresh Sync | Yes | |
| Incremental Sync | Yes | |
| SSL connection | Yes | |
### Performance considerations
The connector is restricted by normal Zendesk [requests limitation](https://developer.zendesk.com/rest_api/docs/voice-api/introduction#rate-limits).
The Zendesk connector should not run into Zendesk API limitations under normal usage. Please [create an issue](https://github.com/airbytehq/airbyte/issues) if you see any rate limit issues that are not automatically retried successfully.
## Getting started
### Requirements
* Zendesk Chat Access Token
### Setup guide
Generate a Access Token as described in [Zendesk Chat docs](https://developer.zendesk.com/rest_api/docs/chat/auth)
We recommend creating a restricted, read-only key specifically for Airbyte access. This will allow you to control which resources Airbyte should be able to access.

View File

@@ -67,6 +67,7 @@ write_standard_creds source-stripe-singer "$STRIPE_INTEGRATION_TEST_CREDS"
write_standard_creds source-stripe "$STRIPE_INTEGRATION_TEST_CREDS"
write_standard_creds source-tempo "$TEMPO_INTEGRATION_TEST_CREDS"
write_standard_creds source-twilio-singer "$TWILIO_TEST_CREDS"
write_standard_creds source-zendesk-chat "$ZENDESK_CHAT_INTEGRATION_TEST_CREDS"
write_standard_creds source-zendesk-support-singer "$ZENDESK_SECRETS_CREDS"
write_standard_creds source-zendesk-talk "$ZENDESK_TALK_TEST_CREDS"
write_standard_creds source-zoom-singer "$ZOOM_INTEGRATION_TEST_CREDS"