diff --git a/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/schemas/conversions.json b/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/schemas/conversions.json new file mode 100644 index 000000000000..c285fb42af3f --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/schemas/conversions.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "id": { + "type": ["string"] + }, + "timestamp": { + "format": "date-time", + "type": ["null", "string"] + }, + "goal_id": { + "type": ["null", "integer"] + }, + "goal_name": { + "type": ["null", "string"] + }, + "attribution": { + "properties": { + "agent_id": { + "type": ["null", "integer"] + }, + "department_id": { + "type": ["null", "integer"] + }, + "chat_id": { + "type": ["null", "string"] + }, + "chat_timestamp": { + "format": "date-time", + "type": ["null", "string"] + } + }, + "type": ["null", "object"], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/schemas/department_events.json b/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/schemas/department_events.json new file mode 100644 index 000000000000..bd0c52233ea8 --- /dev/null +++ b/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/schemas/department_events.json @@ -0,0 +1,27 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "department_id": { + "type": ["null", "integer"] + }, + "timestamp": { + "format": "date-time", + "type": ["null", "string"] + }, + "id": { + "type": ["string"] + }, + "field_name": { + "type": ["null", "string"] + }, + "value": { + "type": ["null", "object"], + "additionalProperties": true + }, + "previous_value": { + "type": ["null", "object"], + "additionalProperties": true + } + } +} diff --git a/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/source.py b/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/source.py index a37d51e8fd46..f7a60d731f66 100644 --- a/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/source.py +++ b/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/source.py @@ -10,7 +10,7 @@ from airbyte_cdk.sources.streams import Stream from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator -from .streams import Accounts, Agents, AgentTimelines, Bans, Chats, Departments, Goals, Roles, RoutingSettings, Shortcuts, Skills, Triggers +from .streams import Accounts, Agents, AgentTimelines, Bans, Chats, Conversions, Departments, DepartmentEvents, Goals, Roles, RoutingSettings, Shortcuts, Skills, Triggers class ZendeskAuthentication: @@ -49,7 +49,9 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]: Agents(authenticator=authenticator), Bans(authenticator=authenticator), Chats(authenticator=authenticator, start_date=config["start_date"]), + Conversions(authenticator=authenticator, start_date=config["start_date"]), Departments(authenticator=authenticator), + DepartmentEvents(authenticator=authenticator, start_date=config["start_date"]), Goals(authenticator=authenticator), Roles(authenticator=authenticator), RoutingSettings(authenticator=authenticator), diff --git a/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/streams.py b/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/streams.py index 1ba4b454f819..ffcfd61a6dee 100644 --- a/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/streams.py +++ b/airbyte-integrations/connectors/source-zendesk-chat/source_zendesk_chat/streams.py @@ -296,3 +296,20 @@ def path( next_page_token: Mapping[str, Any] = None, ) -> str: return "routing_settings/account" + +class DepartmentEvents(TimeIncrementalStream): + """ + Chats Stream: https://developer.zendesk.com/api-reference/live-chat/chat-api/incremental_export/#incremental-department-events-export + """ + cursor_field = "timestamp" + data_field = "department_events" + limit = 1000 + + +class Conversions(TimeIncrementalStream): + """ + Chats Stream: https://developer.zendesk.com/api-reference/live-chat/chat-api/incremental_export/#incremental-conversions-export + """ + cursor_field = "timestamp" + data_field = "conversions" + limit = 1000