Skip to content

Commit

Permalink
Merge pull request #11 from guptaa3/CDAXINFRA-157
Browse files Browse the repository at this point in the history
Adding Zendesk Talk Api - Calls Stream
  • Loading branch information
guptaa3 authored Oct 4, 2021
2 parents 81490f4 + 1eb3103 commit 53dc0cd
Show file tree
Hide file tree
Showing 4 changed files with 277 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.0.7
* Adding Calls stream

## 1.0.7
* Adding key as agent_id for agents_activity
* Adding help center article stream
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='twilio-tap-zendesk',
version='1.0.7',
version='1.0.8',
description='Singer.io tap for extracting data from the Zendesk API',
author='Twilio',
url='https://github.com/twilio-labs/twilio-tap-zendesk',
Expand Down
254 changes: 254 additions & 0 deletions tap_zendesk/schemas/calls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
{
"type": [
"null",
"object"
],
"properties": {
"agent_id": {
"type": [
"null",
"integer"
]
},
"call_charge": {
"type": [
"null",
"string"
]
},
"call_recording_consent": {
"type": [
"null",
"string"
]
},
"call_recording_consent_action": {
"type": [
"null",
"string"
]
},
"call_recording_consent_keypress": {
"type": [
"null",
"string"
]
},
"callback": {
"type": [
"null",
"boolean"
]
},
"callback_source": {
"type": [
"null",
"string"
]
},
"completion_status": {
"type": [
"null",
"string"
]
},
"consultation_time": {
"type": [
"null",
"integer"
]
},
"created_at": {
"type": [
"null",
"string"
]
},
"customer_id": {
"type": [
"null",
"integer"
]
},
"customer_requested_voicemail": {
"type": [
"null",
"boolean"
]
},
"default_group": {
"type": [
"null",
"boolean"
]
},
"direction": {
"type": [
"null",
"string"
]
},
"duration": {
"type": [
"null",
"integer"
]
},
"exceeded_queue_wait_time": {
"type": [
"null",
"boolean"
]
},
"hold_time": {
"type": [
"null",
"integer"
]
},
"id": {
"type": [
"null",
"integer"
]
},
"ivr_action": {
"type": [
"null",
"string"
]
},
"ivr_destination_group_name": {
"type": [
"null",
"string"
]
},
"ivr_hops": {
"type": [
"null",
"string"
]
},
"ivr_routed_to": {
"type": [
"null",
"string"
]
},
"ivr_time_spent": {
"type": [
"null",
"string"
]
},
"minutes_billed": {
"type": [
"null",
"integer"
]
},
"not_recording_time": {
"type": [
"null",
"integer"
]
},
"outside_business_hours": {
"type": [
"null",
"boolean"
]
},
"overflowed": {
"type": [
"null",
"boolean"
]
},
"overflowed_to": {
"type": [
"null",
"string"
]
},
"phone_number": {
"type": [
"null",
"string"
]
},
"phone_number_id": {
"type": [
"null",
"integer"
]
},
"quality_issues": {
"type": [
"null",
"array"
],
"items": {
"type": [
"null",
"string"
]
}
},
"recording_control_interactions": {
"type": [
"null",
"integer"
]
},
"recording_time": {
"type": [
"null",
"integer"
]
},
"talk_time": {
"type": [
"null",
"integer"
]
},
"ticket_id": {
"type": [
"null",
"integer"
]
},
"time_to_answer": {
"type": [
"null",
"integer"
]
},
"updated_at": {
"type": [
"null",
"string"
]
},
"voicemail": {
"type": [
"null",
"boolean"
]
},
"wait_time": {
"type": [
"null",
"integer"
]
},
"wrap_up_time": {
"type": [
"null",
"integer"
]
}
}
}
21 changes: 19 additions & 2 deletions tap_zendesk/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,24 @@ def sync(self, state):
for article in articles:
if check_end_date(article, self.config, self.replication_key):
break
if utils.strptime_with_tz(article.updated_at) >= bookmark:
self.update_bookmark(state, article.updated_at)
yield self.stream, article

yield self.stream, article
class Call(Stream):
name = "calls"
replication_method = "INCREMENTAL"
replication_key = "updated_at"

def sync(self, state):
bookmark = self.get_bookmark(state)
calls = self.client.talk.calls.incremental(start_time=bookmark)
for call in calls:
if check_end_date(call, self.config, self.replication_key):
break
if utils.strptime_with_tz(call.updated_at) >= bookmark:
self.update_bookmark(state, call.updated_at)
yield self.stream, call

STREAMS = {
"tickets": Tickets,
Expand All @@ -617,5 +633,6 @@ def sync(self, state):
"sla_policies": SLAPolicies,
"ticket_metric_events": TicketMetricEvents,
"agents_activity": AgentsActivity,
"articles": Article
"articles": Article,
"calls": Call
}

0 comments on commit 53dc0cd

Please sign in to comment.