Skip to content

Commit

Permalink
✨Source Zendesk Support: New Stream - Topics (airbytehq#27208)
Browse files Browse the repository at this point in the history
* Initial commit

* Update Docs

* Add expected records

* fixed tests

* fixed formatting

* fefactored topics stream

* updated abnormal_state.json

---------

Co-authored-by: Mal Hancock <mallory@archangelic.space>
Co-authored-by: Daryna Ishchenko <darina.ishchenko17@gmail.com>
  • Loading branch information
3 people authored and harrytou committed Sep 1, 2023
1 parent e78ff9f commit abe32e4
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ COPY source_zendesk_support ./source_zendesk_support
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.10.7
LABEL io.airbyte.version=0.11.0
LABEL io.airbyte.name=airbyte/source-zendesk-support
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@
"stream_descriptor": { "name": "posts" }
}
},
{
"type": "STREAM",
"stream": {
"stream_state": { "updated_at": "2222-12-11T19:34:06Z" },
"stream_descriptor": { "name": "topics" }
}
},
{
"type": "STREAM",
"stream": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@
"sync_mode": "full_refresh",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "topics",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["updated_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "posts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@
{"stream": "attribute_definitions", "data": {"title": "Number of incidents", "subject": "number_of_incidents", "type": "text", "group": "ticket", "nullable": false, "repeatable": false, "operators": [{"value": "less_than", "title": "Less than", "terminal": false}, {"value": "greater_than", "title": "Greater than", "terminal": false}, {"value": "is", "title": "Is", "terminal": false}, {"value": "less_than_equal", "title": "Less than or equal to", "terminal": false}, {"value": "greater_than_equal", "title": "Greater than or equal to", "terminal": false}], "condition": "all"}, "emitted_at": 1690888195504}
{"stream": "attribute_definitions", "data": {"title": "Brand", "subject": "brand_id", "type": "list", "group": "ticket", "nullable": false, "repeatable": false, "operators": [{"value": "is", "title": "Is", "terminal": false}, {"value": "is_not", "title": "Is not", "terminal": false}], "values": [{"value": "360000358316", "title": "Airbyte", "enabled": true}], "condition": "all"}, "emitted_at": 1690888195504}
{"stream": "attribute_definitions", "data": {"title": "Form", "subject": "ticket_form_id", "type": "list", "group": "ticket", "nullable": false, "repeatable": false, "operators": [{"value": "is", "title": "Is", "terminal": false}, {"value": "is_not", "title": "Is not", "terminal": false}], "values": [{"value": "360000084116", "title": "Default Ticket Form", "enabled": true}], "condition": "all"}, "emitted_at": 1690888195505}
{"stream":"topics","data":{"id":7253394974479,"url":"https://d3v-airbyte.zendesk.com/api/v2/help_center/community/topics/7253394974479.json","html_url":"https://d3v-airbyte.zendesk.com/hc/en-us/community/topics/7253394974479-Feature-Requests","name":"Feature Requests","description":null,"position":0,"follower_count":1,"community_id":7253391140495,"created_at":"2023-06-22T00:32:21Z","updated_at":"2023-06-22T00:32:21Z","manageable_by":"managers","user_segment_id":null},"emitted_at":1687861697934}
{"stream":"topics","data":{"id":7253351897871,"url":"https://d3v-airbyte.zendesk.com/api/v2/help_center/community/topics/7253351897871.json","html_url":"https://d3v-airbyte.zendesk.com/hc/en-us/community/topics/7253351897871-General-Discussion","name":"General Discussion","description":null,"position":0,"follower_count":1,"community_id":7253391140495,"created_at":"2023-06-22T00:32:20Z","updated_at":"2023-06-22T00:32:20Z","manageable_by":"managers","user_segment_id":null},"emitted_at":1687861697934}
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "topics",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"],
"source_defined_cursor": true,
"default_cursor_field": ["updated_at"],
"source_defined_primary_key": [["id"]]
},
"sync_mode": "incremental",
"destination_sync_mode": "append"
},
{
"stream": {
"name": "users",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data:
connectorType: source
maxSecondsBetweenMessages: 10800
definitionId: 79c1aa37-dae3-42ae-b333-d1c105477715
dockerImageTag: 0.10.7
dockerImageTag: 0.11.0
dockerRepository: airbyte/source-zendesk-support
githubIssueLabel: source-zendesk-support
icon: zendesk-support.svg
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Topics Schema",
"additionalProperties": true,
"type": ["null", "object"],
"properties": {
"html_url": {
"type": ["null", "string"]
},
"id": {
"type": ["null", "number"]
},
"name": {
"type": ["null", "string"]
},
"url": {
"type": ["null", "string"]
},
"created_at": {
"type": ["null", "string"],
"format": "date-time"
},
"updated_at": {
"type": ["null", "string"],
"format": "date-time"
},
"description": {
"type": ["null", "string"]
},
"manageable_by": {
"type": ["null", "string"]
},
"follower_count": {
"type": ["null", "number"]
},
"position": {
"type": ["null", "number"]
},
"user_segment_id": {
"type": ["null", "number"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
TicketMetrics,
Tickets,
TicketSkips,
Topics,
Users,
UserSettingsStream,
)
Expand Down Expand Up @@ -140,6 +141,7 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
TicketMetricEvents(**args),
TicketSkips(**args),
Tickets(**args),
Topics(**args),
Users(**args),
Brands(**args),
CustomRoles(**args),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,17 @@ class Tags(FullRefreshZendeskSupportStream):
primary_key = "name"


class Topics(CursorPaginationZendeskSupportStream):
"""
Topics stream: https://developer.zendesk.com/api-reference/help_center/help-center-api/topics/#list-topics
"""

cursor_field = "updated_at"

def path(self, **kwargs):
return "community/topics"


class SlaPolicies(FullRefreshZendeskSupportStream):
"""SlaPolicies stream: https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
TicketMetrics,
Tickets,
TicketSkips,
Topics,
Users,
UserSettingsStream,
)
Expand Down Expand Up @@ -142,18 +143,18 @@ def test_check(response, start_date, check_passed):
@pytest.mark.parametrize(
"ticket_forms_response, status_code, expected_n_streams, expected_warnings, reason",
[
('{"ticket_forms": [{"id": 1, "updated_at": "2021-07-08T00:05:45Z"}]}', 200, 27, [], None),
('{"ticket_forms": [{"id": 1, "updated_at": "2021-07-08T00:05:45Z"}]}', 200, 28, [], None),
(
'{"error": "Not sufficient permissions"}',
403,
24,
25,
["Skipping stream ticket_forms: Check permissions, error message: Not sufficient permissions."],
None
),
(
'',
404,
24,
25,
["Skipping stream ticket_forms: Check permissions, error message: {'title': 'Not Found', 'message': 'Received empty JSON response'}."],
'Not Found'
),
Expand Down Expand Up @@ -257,6 +258,7 @@ class TestAllStreams:
(TicketSkips),
(TicketMetricEvents),
(Tickets),
(Topics),
(Users),
(Brands),
(CustomRoles),
Expand All @@ -283,6 +285,7 @@ class TestAllStreams:
"TicketSkips",
"TicketMetricEvents",
"Tickets",
"Topics",
"Users",
"Brands",
"CustomRoles",
Expand Down Expand Up @@ -321,6 +324,7 @@ def test_streams(self, expected_stream_cls):
(TicketMetricEvents, "incremental/ticket_metric_events"),
(Tickets, "incremental/tickets/cursor.json"),
(Users, "incremental/users/cursor.json"),
(Topics, "community/topics"),
(Brands, "brands"),
(CustomRoles, "custom_roles"),
(Schedules, "business_hours/schedules.json"),
Expand All @@ -346,6 +350,7 @@ def test_streams(self, expected_stream_cls):
"TicketSkips",
"TicketMetricEvents",
"Tickets",
"Topics",
"Users",
"Brands",
"CustomRoles",
Expand All @@ -371,6 +376,7 @@ class TestSourceZendeskSupportStream:
(SatisfactionRatings),
(TicketFields),
(TicketMetrics),
(Topics)
],
ids=[
"Macros",
Expand All @@ -380,6 +386,7 @@ class TestSourceZendeskSupportStream:
"SatisfactionRatings",
"TicketFields",
"TicketMetrics",
"Topics"
],
)
def test_parse_response(self, requests_mock, stream_cls):
Expand All @@ -401,6 +408,7 @@ def test_parse_response(self, requests_mock, stream_cls):
(SatisfactionRatings),
(TicketFields),
(TicketMetrics),
(Topics)
],
ids=[
"Macros",
Expand All @@ -410,6 +418,7 @@ def test_parse_response(self, requests_mock, stream_cls):
"SatisfactionRatings",
"TicketFields",
"TicketMetrics",
"Topics"
],
)
def test_url_base(self, stream_cls):
Expand All @@ -432,6 +441,7 @@ def test_url_base(self, stream_cls):
(SatisfactionRatings, {}, {"updated_at": "2022-03-17T16:03:07Z"}, {"updated_at": "2022-03-17T16:03:07Z"}),
(TicketFields, {}, {"updated_at": "2022-03-17T16:03:07Z"}, {"updated_at": "2022-03-17T16:03:07Z"}),
(TicketMetrics, {}, {"updated_at": "2022-03-17T16:03:07Z"}, {"updated_at": "2022-03-17T16:03:07Z"}),
(Topics, {}, {"updated_at": "2022-03-17T16:03:07Z"}, {"updated_at": "2022-03-17T16:03:07Z"}),
],
ids=[
"Macros",
Expand All @@ -441,6 +451,7 @@ def test_url_base(self, stream_cls):
"SatisfactionRatings",
"TicketFields",
"TicketMetrics",
"Topics"
],
)
def test_get_updated_state(self, stream_cls, current_state, last_record, expected):
Expand Down
8 changes: 5 additions & 3 deletions docs/integrations/sources/zendesk-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ The Zendesk Support source connector supports the following streams:
- [Ticket Forms](https://developer.zendesk.com/rest_api/docs/support/ticket_forms) \(Incremental\)
- [Ticket Metrics](https://developer.zendesk.com/rest_api/docs/support/ticket_metrics) \(Incremental\)
- [Ticket Metric Events](https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_metric_events/) \(Incremental\)
- [Topics](https://developer.zendesk.com/api-reference/help_center/help-center-api/topics/#list-topics) \(Incremental\)
- [Ticket Skips](https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_skips/) \(Incremental\)
- [Users](https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-user-export) \(Incremental\)
- [Post Comments](https://developer.zendesk.com/api-reference/help_center/help-center-api/post_comments/)
Expand All @@ -79,9 +80,10 @@ The Zendesk connector ideally should not run into Zendesk API limitations under

| Version | Date | Pull Request | Subject |
|:---------|:-----------|:---------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `0.10.7` | 2023-08-09 | [29256](https://github.com/airbytehq/airbyte/pull/29256) | Update tooltip descriptions in spec |
| `0.10.6` | 2023-08-04 | [29031](https://github.com/airbytehq/airbyte/pull/29031) | Reverted `advancedAuth` spec changes |
| `0.10.5` | 2023-08-01 | [28910](https://github.com/airbytehq/airbyte/pull/28910) | Updated `advancedAuth` broken references |
| `0.11.0` | 2023-08-10 | [27208](https://github.com/airbytehq/airbyte/pull/27208) | Add stream `Topics` |
| `0.10.7` | 2023-08-09 | [29256](https://github.com/airbytehq/airbyte/pull/29256) | Update tooltip descriptions in spec |
| `0.10.6` | 2023-08-04 | [29031](https://github.com/airbytehq/airbyte/pull/29031) | Reverted `advancedAuth` spec changes |
| `0.10.5` | 2023-08-01 | [28910](https://github.com/airbytehq/airbyte/pull/28910) | Updated `advancedAuth` broken references |
| `0.10.4` | 2023-07-25 | [28397](https://github.com/airbytehq/airbyte/pull/28397) | Handle 404 Error |
| `0.10.3` | 2023-07-24 | [28612](https://github.com/airbytehq/airbyte/pull/28612) | Fix pagination for stream `TicketMetricEvents` |
| `0.10.2` | 2023-07-19 | [28487](https://github.com/airbytehq/airbyte/pull/28487) | Remove extra page from params |
Expand Down

0 comments on commit abe32e4

Please sign in to comment.