Skip to content

Commit ba63c03

Browse files
feat(source-zendesk-support): add automations and triggers streams (#44610)
Signed-off-by: Henri Blancke <[email protected]> Co-authored-by: Marcos Marx <[email protected]> Co-authored-by: marcosmarxm <[email protected]>
1 parent 8332ddc commit ba63c03

File tree

10 files changed

+261
-5
lines changed

10 files changed

+261
-5
lines changed

airbyte-integrations/connectors/source-zendesk-support/integration_tests/configured_catalog.json

+24
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,30 @@
1212
"sync_mode": "full_refresh",
1313
"destination_sync_mode": "append"
1414
},
15+
{
16+
"stream": {
17+
"name": "automations",
18+
"json_schema": {},
19+
"supported_sync_modes": ["full_refresh", "incremental"],
20+
"source_defined_cursor": true,
21+
"default_cursor_field": ["created_at"],
22+
"source_defined_primary_key": [["id"]]
23+
},
24+
"sync_mode": "full_refresh",
25+
"destination_sync_mode": "append"
26+
},
27+
{
28+
"stream": {
29+
"name": "triggers",
30+
"json_schema": {},
31+
"supported_sync_modes": ["full_refresh", "incremental"],
32+
"source_defined_cursor": true,
33+
"default_cursor_field": ["created_at"],
34+
"source_defined_primary_key": [["id"]]
35+
},
36+
"sync_mode": "full_refresh",
37+
"destination_sync_mode": "append"
38+
},
1539
{
1640
"stream": {
1741
"name": "group_memberships",

airbyte-integrations/connectors/source-zendesk-support/integration_tests/expected_records.jsonl

+2
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,5 @@
7171
{"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": 1720179652468}
7272
{"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": 1720179652472}
7373
{"stream": "ticket_forms", "data": {"id": 360000084116, "raw_name": "Default Ticket Form", "raw_display_name": "Default Ticket Form", "end_user_visible": true, "position": 1, "ticket_field_ids": [360002833076, 360002833096, 360002833116, 360002833136, 360002833156, 360002833176, 360002833196], "active": true, "default": true, "in_all_brands": true, "restricted_brand_ids": [], "end_user_conditions": [], "agent_conditions": [], "url": "https://d3v-airbyte.zendesk.com/api/v2/ticket_forms/360000084116.json", "name": "Default Ticket Form", "display_name": "Default Ticket Form", "created_at": "2020-12-11T18:34:37Z", "updated_at": "2020-12-11T18:34:37Z"}, "emitted_at": 1720179653174}
74+
{"stream":"automations","data":{"url":"https://d3v-airbyte.zendesk.com/api/v2/automations/6241378811151.json","id":6241378811151,"title":"Close ticket 4 days after status is set to solved","active":true,"updated_at":"2023-01-19T00:26:48Z","created_at":"2023-01-19T00:26:48Z","default":true,"actions":[{"field":"status","value":"closed"}],"conditions":{"all":[{"field":"status","operator":"is","value":"solved"},{"field":"SOLVED","operator":"greater_than","value":"480"}],"any":[]},"position":0,"raw_title":"Close ticket 4 days after status is set to solved"},"emitted_at":1725816608179}
75+
{"stream":"triggers","data":{"url":"https://d3v-airbyte.zendesk.com/api/v2/triggers/7282769224079.json","id":7282769224079,"title":"Request customer satisfaction rating (social messaging)","active":true,"updated_at":"2023-06-26T10:48:19Z","created_at":"2023-06-26T10:48:19Z","default":false,"actions":[{"field":"notification_messaging_csat","value":"requester_id"}],"conditions":{"all":[{"field":"status","operator":"value","value":"solved"}],"any":[{"field":"via_id","operator":"is","value":"73"},{"field":"via_id","operator":"is","value":"72"},{"field":"via_id","operator":"is","value":"74"},{"field":"via_id","operator":"is","value":"78"},{"field":"via_id","operator":"is","value":"88"}]},"description":"Asks customer for a rating after the conversation is over. This trigger is created by the system.","position":8,"raw_title":"Request customer satisfaction rating (social messaging)","category_id":"1276235"},"emitted_at":1725816657977}

airbyte-integrations/connectors/source-zendesk-support/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ data:
1111
connectorSubtype: api
1212
connectorType: source
1313
definitionId: 79c1aa37-dae3-42ae-b333-d1c105477715
14-
dockerImageTag: 4.1.1
14+
dockerImageTag: 4.2.0
1515
dockerRepository: airbyte/source-zendesk-support
1616
documentationUrl: https://docs.airbyte.com/integrations/sources/zendesk-support
1717
githubIssueLabel: source-zendesk-support

airbyte-integrations/connectors/source-zendesk-support/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
33
build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
6-
version = "4.1.1"
6+
version = "4.2.0"
77
name = "source-zendesk-support"
88
description = "Source implementation for Zendesk Support."
99
authors = [ "Airbyte <[email protected]>",]

airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/manifest.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,17 @@ definitions:
199199
path: "tags"
200200
primary_key: "name"
201201

202+
automations_stream:
203+
$ref: "#/definitions/base_stream"
204+
retriever:
205+
$ref: "#/definitions/retriever"
206+
paginator:
207+
$ref: "#/definitions/links_next_paginator"
208+
$parameters:
209+
name: "automations"
210+
path: "automations"
211+
primary_key: "id"
212+
202213
# Incremental cursor-based streams
203214
audit_logs_stream:
204215
$ref: "#/definitions/base_incremental_stream"
@@ -554,6 +565,14 @@ definitions:
554565
cursor_field: "updated_at"
555566
primary_key: "id"
556567

568+
triggers_stream:
569+
$ref: "#/definitions/semi_incremental_stream"
570+
$parameters:
571+
name: "triggers"
572+
path: "triggers"
573+
cursor_field: "updated_at"
574+
primary_key: "id"
575+
557576
users_stream:
558577
$ref: "#/definitions/base_incremental_stream"
559578
retriever:
@@ -581,6 +600,7 @@ streams:
581600
- $ref: "#/definitions/ticket_forms_stream"
582601
- $ref: "#/definitions/topics_stream"
583602
- $ref: "#/definitions/user_fields_stream"
603+
- $ref: "#/definitions/automations_stream"
584604
# Incremental streams
585605
- $ref: "#/definitions/audit_logs_stream"
586606
- $ref: "#/definitions/groups_stream"
@@ -595,4 +615,5 @@ streams:
595615
- $ref: "#/definitions/ticket_comments_stream"
596616
- $ref: "#/definitions/ticket_metric_events_stream"
597617
- $ref: "#/definitions/ticket_skips_stream"
618+
- $ref: "#/definitions/triggers_stream"
598619
- $ref: "#/definitions/users_stream"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"properties": {
5+
"actions": {
6+
"type": "array",
7+
"description": "An object describing what the automation will do",
8+
"items": {
9+
"type": ["object", "null"],
10+
"properties": {
11+
"field": {
12+
"type": ["string", "null"]
13+
},
14+
"value": {
15+
"type": ["string", "null"]
16+
}
17+
}
18+
}
19+
},
20+
"active": {
21+
"type": ["boolean", "null"],
22+
"description": "Whether the automation is active"
23+
},
24+
"conditions": {
25+
"type": "object",
26+
"description": "An object that describes the conditions under which the automation will execute",
27+
"properties": {
28+
"all": {
29+
"type": "array",
30+
"items": {
31+
"type": ["object", "null"],
32+
"properties": {
33+
"field": {
34+
"type": ["string", "null"]
35+
},
36+
"operator": {
37+
"type": ["string", "null"]
38+
},
39+
"value": {
40+
"type": ["string", "null"]
41+
}
42+
}
43+
}
44+
},
45+
"any": {
46+
"type": "array",
47+
"items": {
48+
"type": ["object", "null"],
49+
"properties": {
50+
"field": {
51+
"type": ["string", "null"]
52+
},
53+
"operator": {
54+
"type": ["string", "null"]
55+
},
56+
"value": {
57+
"type": ["string", "null"]
58+
}
59+
}
60+
}
61+
}
62+
}
63+
},
64+
"created_at": {
65+
"description": "The time the automation was created",
66+
"type": ["string", "null"]
67+
},
68+
"default": {
69+
"type": ["boolean", "null"],
70+
"description": "If true, the automation is a default automation"
71+
},
72+
"id": {
73+
"type": ["integer", "null"],
74+
"description": "Automatically assigned when created"
75+
},
76+
"position": {
77+
"type": ["integer", "null"],
78+
"description": "The position of the automation which specifies the order it will be executed"
79+
},
80+
"raw_title": {
81+
"type": ["string", "null"],
82+
"description": "The raw title of the automation"
83+
},
84+
"title": {
85+
"type": ["string", "null"],
86+
"description": "The title of the automation"
87+
},
88+
"updated_at": {
89+
"description": "The time of the last update of the automation",
90+
"type": ["string", "null"]
91+
}
92+
}
93+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"type": ["null", "object"],
4+
"properties": {
5+
"actions": {
6+
"type": ["array", "null"],
7+
"description": "An array of actions describing what the ticket trigger will do",
8+
"items": {
9+
"type": "object",
10+
"properties": {
11+
"field": {
12+
"type": ["string", "null"]
13+
},
14+
"value": {
15+
"type": ["string", "null"]
16+
}
17+
}
18+
}
19+
},
20+
"active": {
21+
"description": "Whether the ticket trigger is active",
22+
"type": "boolean"
23+
},
24+
"category_id": {
25+
"description": "The ID of the category the ticket trigger belongs to",
26+
"type": ["string", "null"]
27+
},
28+
"conditions": {
29+
"description": "An object that describes the circumstances under which the trigger performs its actions",
30+
"type": "object",
31+
"properties": {
32+
"all": {
33+
"type": ["array", "null"],
34+
"items": {
35+
"type": "object",
36+
"properties": {
37+
"field": {
38+
"type": ["string", "null"]
39+
},
40+
"operator": {
41+
"type": ["string", "null"]
42+
},
43+
"value": {
44+
"type": ["string", "null"]
45+
}
46+
}
47+
}
48+
},
49+
"any": {
50+
"type": ["array", "null"],
51+
"items": {
52+
"type": "object",
53+
"properties": {
54+
"field": {
55+
"type": ["string", "null"]
56+
},
57+
"operator": {
58+
"type": ["string", "null"]
59+
},
60+
"value": {
61+
"type": ["string", "null"]
62+
}
63+
}
64+
}
65+
}
66+
}
67+
},
68+
"created_at": {
69+
"description": "The time the ticket trigger was created",
70+
"type": ["string", "null"]
71+
},
72+
"default": {
73+
"description": "If true, the ticket trigger is a standard trigger",
74+
"type": "boolean"
75+
},
76+
"description": {
77+
"description": "The description of the ticket trigger",
78+
"type": ["string", "null"]
79+
},
80+
"id": {
81+
"description": "Automatically assigned when created",
82+
"type": "integer"
83+
},
84+
"position": {
85+
"description": "Position of the ticket trigger, determines the order they will execute in",
86+
"type": "integer"
87+
},
88+
"raw_title": {
89+
"description": "The raw format of the title of the ticket trigger",
90+
"type": ["string", "null"]
91+
},
92+
"title": {
93+
"description": "The title of the ticket trigger",
94+
"type": ["string", "null"]
95+
},
96+
"updated_at": {
97+
"description": "The time of the last update of the ticket trigger",
98+
"type": ["string", "null"]
99+
},
100+
"url": {
101+
"description": "The url of the ticket trigger",
102+
"type": ["string", "null"]
103+
}
104+
}
105+
}

airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/streams.py

+8
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,10 @@ class AuditLogs(CursorPaginationZendeskSupportStream):
431431
cursor_field = "created_at"
432432

433433

434+
class Automations(FullRefreshZendeskSupportStream):
435+
"""Automations stream: https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#list-automations"""
436+
437+
434438
class Users(SourceZendeskIncrementalExportStream):
435439
"""Users stream: https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-user-export"""
436440

@@ -779,6 +783,10 @@ def path(self, **kwargs):
779783
return "community/topics"
780784

781785

786+
class Triggers(CursorPaginationZendeskSupportStream):
787+
"""Triggers stream: https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#list-ticket-triggers"""
788+
789+
782790
class SlaPolicies(IncrementalZendeskSupportStream):
783791
"""SlaPolicies stream: https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/"""
784792

airbyte-integrations/connectors/source-zendesk-support/unit_tests/unit_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ def test_check(response, start_date, check_passed):
185185
@pytest.mark.parametrize(
186186
"ticket_forms_response, status_code, expected_n_streams, expected_warnings, reason",
187187
[
188-
('{"ticket_forms": [{"id": 1, "updated_at": "2021-07-08T00:05:45Z"}]}', 200, 35, [], None),
188+
('{"ticket_forms": [{"id": 1, "updated_at": "2021-07-08T00:05:45Z"}]}', 200, 37, [], None),
189189
(
190190
'{"error": "Not sufficient permissions"}',
191191
403,
192-
32,
192+
34,
193193
[
194194
"An exception occurred while trying to access TicketForms stream: Forbidden. You don't have permission to access this resource.. Skipping this stream."
195195
],
@@ -198,7 +198,7 @@ def test_check(response, start_date, check_passed):
198198
(
199199
"",
200200
404,
201-
32,
201+
34,
202202
[
203203
"An exception occurred while trying to access TicketForms stream: Not found. The requested resource was not found on the server.. Skipping this stream."
204204
],

docs/integrations/sources/zendesk-support.md

+3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ The Zendesk Support source connector supports the following streams:
114114
- [Article Comment Votes](https://developer.zendesk.com/api-reference/help_center/help-center-api/votes/#list-votes) \(Incremental\)
115115
- [Attribute Definitions](https://developer.zendesk.com/api-reference/ticketing/ticket-management/skill_based_routing/#list-routing-attribute-definitions)
116116
- [Audit Logs](https://developer.zendesk.com/api-reference/ticketing/account-configuration/audit_logs/#list-audit-logs)\(Incremental\) (Only available for enterprise accounts)
117+
- [Automations](https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#list-automations)
117118
- [Brands](https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#list-brands)
118119
- [Custom Roles](https://developer.zendesk.com/api-reference/ticketing/account-configuration/custom_roles/#list-custom-roles) \(Incremental\)
119120
- [Groups](https://developer.zendesk.com/rest_api/docs/support/groups) \(Incremental\)
@@ -138,6 +139,7 @@ The Zendesk Support source connector supports the following streams:
138139
- [Ticket Metrics](https://developer.zendesk.com/rest_api/docs/support/ticket_metrics) \(Incremental\)
139140
- [Ticket Metric Events](https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_metric_events/) \(Incremental\)
140141
- [Topics](https://developer.zendesk.com/api-reference/help_center/help-center-api/topics/#list-topics) \(Incremental\)
142+
- [Triggers](https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#list-ticket-triggers) \(Incremental\)
141143
- [Ticket Skips](https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_skips/) \(Incremental\)
142144
- [Users](https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-user-export) \(Incremental\)
143145
- [UserFields](https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#list-user-fields)
@@ -182,6 +184,7 @@ The Zendesk connector ideally should not run into Zendesk API limitations under
182184

183185
| Version | Date | Pull Request | Subject |
184186
|:--------|:-----------|:---------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
187+
| 4.2.0 | 2024-09-10 | [44610](https://github.com/airbytehq/airbyte/pull/44610) | Add `Automations` and `Triggers` stream |
185188
| 4.1.1 | 2024-09-07 | [45215](https://github.com/airbytehq/airbyte/pull/45215) | Update dependencies |
186189
| 4.1.0 | 2024-09-06 | [45187](https://github.com/airbytehq/airbyte/pull/45187) | Migrate to CDK v5 |
187190
| 4.0.2 | 2024-08-31 | [44965](https://github.com/airbytehq/airbyte/pull/44965) | Update dependencies |

0 commit comments

Comments
 (0)