The following document describes how to utilize the Zendesk API to load data from Zendesk into Neo4j, specifically data about users who have choosen to subscribe/follow Knowledge Base section(s). This document attempts to solve the issue described by the following questions from Zendesk Question & Answers. Although the Zendesk UI allows users to subscribe/follow a Knowledge Section it does not provide an equivalent UI for a Zendesk Administrator to see what users are subscribed to each section.
The Cypher below, will create supporting indexes and then iterate overr every section, request all the user_ids with said section, create the relationship between the user_id and section and then populate the user_id with more identifying details.
and to load 140 nodes (81 Users, 7 Sections, 52 Organizations) and associated relationships took 54 seconds.
In the above Cypher code, you will need to replace all occurances of
`your_domain` with the actual domain your Zendesk is hosted under `base64Encoded_username:password` with the base64 encoding (https://www.base64encode.org/) of a Zendesk Admin user and password who has Admin rights in Zendesk
Additionally, to use basic authentication, you must enable password access in the Zendesk Support admin interface at Admin > Channels > API.
Finally, per the Zendesk API, if you expect to have more than 100 results per API call you will need to consider Pagination.
Copying the above Cypher into a shell script file, for example build_zd.cql, will then allow for it to be run through cypher-shell by running
And the resultant graph model is thus defined as
The entire graph thus appears as
To which we will see there are 4 Sections (i.e. green nodes/circles) which have no subscribers (i.e the 4 green nodes in the upper left corner). Three other sections have subscribers, though the Section on the right has the most subscribers (i.e blue nodes/circles) Additionally some subscribers/users have choosen to follow multiple sections.
Each Node is defined with the following properties
Usefull Cypher statements to query the graph
- Find # of users subscribed by Section
- Find users and associated organization, per section and when the user subscribed subscribed