Skip to content

Commit c15ffe0

Browse files
committed
add talk_call stream + other minor changes
1 parent ad9908f commit c15ffe0

File tree

5 files changed

+250
-4
lines changed

5 files changed

+250
-4
lines changed

tap_zendesk/schemas/archive/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder contains not implemented stream schemas
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"type": ["object"],
3+
"properties": {
4+
"agent_id": {
5+
"type": ["integer"]
6+
},
7+
"agent_state": {
8+
"type": [
9+
"string",
10+
"null"
11+
],
12+
"description": "The availability state of the agent",
13+
"enum": [
14+
"online",
15+
"offline",
16+
"away"
17+
]
18+
},
19+
"call_status": {
20+
"type": [
21+
"string",
22+
"null"
23+
],
24+
"description": "The call status of the agent",
25+
"enum": [
26+
"on_call",
27+
"wrap_up",
28+
"null"
29+
]
30+
},
31+
"via": {
32+
"type": [
33+
"string",
34+
"null"
35+
],
36+
"description": "The channel (client/phone) the agent is registered to"
37+
}
38+
}
39+
}

tap_zendesk/schemas/talk_calls.json

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
{
2+
"type": ["object"],
3+
"properties": {
4+
"agent_id": {
5+
"type": ["integer", "null"],
6+
"description": "The id of the first agent who picked up the call"
7+
},
8+
"call_charge": {
9+
"type": ["string", "null"],
10+
"description": "Total charge for the call. String representation of a decimal number with six decimal places. Example: \"1.230000\". Null if no charge was received from Twilio"
11+
},
12+
"call_group_id": {
13+
"type": ["integer", "null"],
14+
"description": "The id number of the group the call was last placed in before completion."
15+
},
16+
"call_recording_consent": {
17+
"type": ["string"],
18+
"description": "Call recording consent value configured for the phone number",
19+
"enum": ["always", "opt_in", "opt_out", "never"]
20+
},
21+
"call_recording_consent_action": {
22+
"type": ["string", "null"],
23+
"description": "Keypress the caller chose to give their call recording consent option.",
24+
"enum": ["3"]
25+
},
26+
"callback": {
27+
"type": ["boolean"],
28+
"description": "True if the call was initiated by a callback request from the customer"
29+
},
30+
"callback_source": {
31+
"type": ["string", "null"],
32+
"description": "The source of the callback request",
33+
"enum": ["queue", "web widget"]
34+
},
35+
"completion_status": {
36+
"type": ["string"],
37+
"description": "Status of the call",
38+
"enum": ["completed", "abandoned_in_queue", "abandoned_in_ivr", "abandoned_in_voicemail", "abandoned_on_hold", "pending_voicemail"]
39+
},
40+
"consultation_time": {
41+
"type": ["integer"],
42+
"description": "Sum of how long in seconds agents consulted with each other while the customer was on hold"
43+
},
44+
"created_at": {
45+
"type": ["string"],
46+
"description": "When the call object was created",
47+
"format": "date-time"
48+
},
49+
"customer_id": {
50+
"type": ["integer", "null"],
51+
"description": "!!! not documented field !!!"
52+
},
53+
"customer_requested_voicemail": {
54+
"type": ["boolean"],
55+
"description": "The customer requested to be directed to voicemail instead of waiting for an agent to answer"
56+
},
57+
"default_group": {
58+
"type": ["boolean"],
59+
"description": "The call was answered by an agent who is a member of the call's default group, if group routing is used"
60+
},
61+
"direction": {
62+
"type": ["string"],
63+
"description": "Inbound or outbound. The agent or customer who initialized the call"
64+
},
65+
"duration": {
66+
"type": ["integer"],
67+
"description": "Call duration in seconds"
68+
},
69+
"exceeded_queue_time": {
70+
"type": ["boolean"],
71+
"description": "The customer exceeded the maximum queue wait time and did not speak with an agent"
72+
},
73+
"hold_time": {
74+
"type": ["integer"],
75+
"description": "Sum of how long in seconds the customer was placed on hold by an agent(s)"
76+
},
77+
"id": {
78+
"type": ["integer"],
79+
"description": "Call id"
80+
},
81+
"ivr_action": {
82+
"type": ["string", "null"],
83+
"description": "Menu action that was used by the caller in the IVR menu selection",
84+
"enum": [
85+
"null", "menu", "voicemail", "group", "phone_number", "textback", "invalid"
86+
]
87+
},
88+
"ivr_destination_group_name": {
89+
"type": ["string", "null"],
90+
"description": "Name of the group that received the call through IVR routing. null if IVR is disabled"
91+
},
92+
"ivr_hops": {
93+
"type": ["integer", "null"],
94+
"description": "How many menu options the customer went through in IVR before talking to an agent. null if IVR is disabled"
95+
},
96+
"ivr_routed_to": {
97+
"type": ["string", "null"],
98+
"description": "Phone number where call was routed to by IVR. Example: \"+1311123456789\". null if IVR is disabled"
99+
},
100+
"ivr_time_spent": {
101+
"type": ["integer", "null"],
102+
"description": "How long in seconds the customer spent in IVR. Null if IVR is disabled"
103+
},
104+
"minutes_billed": {
105+
"type": ["integer"],
106+
"description": "Minutes billed"
107+
},
108+
"not_recording_time": {
109+
"type": ["integer"],
110+
"description": "How long in seconds spent not recording on the call"
111+
},
112+
"outside_business_hours": {
113+
"type": ["boolean"],
114+
"description": "The call was received outside business hours"
115+
},
116+
"overflowed": {
117+
"type": ["boolean"],
118+
"description": "True if the call overflowed"
119+
},
120+
"overflowed_to": {
121+
"type": ["string", "null"],
122+
"description": "The phone number that the call overflowed to. null if overflowed is false"
123+
},
124+
"phone_number": {
125+
"type": ["string", "null"],
126+
"description": "Talk phone associated with the call. Example: \"+1311123456789\""
127+
},
128+
"phone_number_id": {
129+
"type": ["integer"],
130+
"description": "Talk phone number id"
131+
},
132+
"quality_issues": {
133+
"type": ["array"],
134+
"description": "A summary of the call's quality issues related to the call provided to Zendesk from Twilio. Until the information is made available by Twilio, the array contains \"information_not_available\". If there are no issues, the array contains \"none\". Other possible values: one or more of \"silence\", \"high_jitter\", \"high_packet_loss\", \"high_pdd\", \"high_latency\"",
135+
"items": {
136+
"type": "string",
137+
"enum": [
138+
"information_not_available",
139+
"none",
140+
"silence",
141+
"high_jitter",
142+
"high_packet_loss",
143+
"high_pdd",
144+
"high_latency"
145+
]
146+
}
147+
},
148+
"recording_control_interactions": {
149+
"type": ["integer"],
150+
"description": "The amount of times agents have paused or resumed a recording on the call."
151+
},
152+
"recording_time": {
153+
"type": ["integer"],
154+
"description": "How long in seconds spent recording on the call"
155+
},
156+
"talk_time": {
157+
"type": ["integer"],
158+
"description": "Sum of how long in seconds the customer was in conference with an agent(s). If a call is not accepted by an agent this will be 0"
159+
},
160+
"ticket_id": {
161+
"type": ["integer", "null"],
162+
"description": "The id of the ticket related to the call"
163+
},
164+
"time_to_answer": {
165+
"type": ["integer", "null"],
166+
"description": "How long in seconds the customer waited for an agent to answer after hearing the Available agents greeting"
167+
},
168+
"updated_at": {
169+
"type": ["string"],
170+
"description": "When the call object was last created",
171+
"format": "date-time"
172+
},
173+
"voicemail": {
174+
"type": ["boolean"],
175+
"description": "If true, the call was a voicemail"
176+
},
177+
"wait_time": {
178+
"type": ["integer"],
179+
"description": "How long in seconds the customer was in the call before an agent answered"
180+
},
181+
"wrap_up_time": {
182+
"type": ["integer"],
183+
"description": "Sum of how long in seconds the agent(s) spent in wrap up"
184+
}
185+
}
186+
}

tap_zendesk/schemas/talk_phone_numbers.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
"type": [
3-
"null",
4-
"object"
5-
],
2+
"type": ["object"],
63
"properties": {
74
"capabilities": {
85
"type": [

tap_zendesk/streams.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,28 @@ def sync(self, state): # pylint: disable=unused-argument
647647
for phone_number in self.client.talk.phone_numbers():
648648
yield (self.stream, phone_number)
649649

650+
651+
class TalkCalls(Stream):
652+
name = 'talk_calls'
653+
replication_method = "INCREMENTAL"
654+
replication_key = 'updated_at'
655+
656+
def sync(self, state):
657+
bookmark = self.get_bookmark(state)
658+
659+
if not bookmark:
660+
start_date = self.config.get('start_date')
661+
if start_date:
662+
bookmark = utils.strptime_with_tz(start_date)
663+
664+
LOGGER.info(f'Start date: {bookmark}')
665+
666+
for call in self.client.talk.calls.incremental(start_time=bookmark):
667+
if utils.strptime_with_tz(call.updated_at) >= bookmark:
668+
self.update_bookmark(state, call.updated_at)
669+
yield (self.stream, call)
670+
671+
650672
STREAMS = {
651673
"tickets": Tickets,
652674
"groups": Groups,
@@ -663,4 +685,5 @@ def sync(self, state): # pylint: disable=unused-argument
663685
"ticket_metrics": TicketMetrics,
664686
"sla_policies": SLAPolicies,
665687
"talk_phone_numbers": TalkPhoneNumbers,
688+
"talk_calls": TalkCalls
666689
}

0 commit comments

Comments
 (0)