generateZenDeskTimeReport.rb
leverages the ZenDesk v2 API and generates a report of all time logged for each agent since the report start time. Time is recorded and saved using the ZenDesk App: zendesk/timetracking_app
.
git clone https://github.com/bryankaraffa/rs-zendesk_timeloggedReport.git
The Zendesk Ruby API client can be installed using Rubygems:
gem install zendesk_api
The API URL for your ZenDesk deployment
The ZenDesk user to use to access the ZenDesk API [must have admin
privileges]
The API token for the ZenDesk user to authenticate with. API tokens are managed in the Zendesk Admin interface at Admin > Channels > API.
Report length [in seconds]. Default is 86400
[24 hours] if not specified. Cannot be used in conjunction with $zendesk_reportStartTime
The Report Start Time, represented in epoch time [UTC / seconds]. If $zendesk_reportStartTime
is defined, then $zendesk_reportLength
is ignored
export zendesk_url="https://mycompany.zendesk.com/api/v2"
export zendesk_email="[email protected]"
export zendesk_token="ABC__super-secret-token__XYZ"
export zendesk_reportLength=43200
ruby generateZenDeskTimeReport.rb
All times are reported in seconds.
Report Length: 12:00:00 [hh:mm:ss]
Report Start Time: 2015-10-28 08:16:37 UTC
Report End Time: 2015-10-28 20:16:37 UTC [current time in UTC]
--Results--
[email protected]: 03:56:00 [hh:mm:ss]
[email protected]: 04:28:00 [hh:mm:ss]
[email protected]: 07:45:00 [hh:mm:ss]
--Debugging--
{
"1160496237": {
"email": "[email protected]",
"totalTime": 14160,
"tickets": {
"96292": 6240,
"97515": 7920
}
},
"1166315698": {
"email": "[email protected]",
"totalTime": 16080,
"tickets": {
"97468": 4140,
"97612": 8940,
"97695": 3000
}
},
"1160491037": {
"email": "[email protected]",
"totalTime": 27900,
"tickets": {
"97375": 1500,
"41316": 900,
"97489": 300,
"96924": 300,
"97618": 3600,
"97621": 1200,
"97397": 5400,
"95379": 600,
"97296": 600,
"97698": 3000,
"97619": 10500
}
}
}