Within Teamwork Desk, you can use
the template editor to test and preview your
Desk Data Viewer settings.
The Data Viewer is designed to allow
you to fetch data from remote systems and
display that data in Desk. You can make calls
to open and authenticated JSON APIs and use a
template to format how the response will
look.
Go to the Integrations subsection of
your site settings and select the Desk
Data Viewer option.
While viewing the integration,
scroll to the Template editor subsection below the integration
settings.
Desk data
At the top of this editor, you can
use the dropdown to change between ticket and
customer examples.
These examples show the data
available for replacement in the Query and Body settings using the
replacement identifier
${
}
.- For example, if you want to get the value
of a customer's email for use in the Query string, you can use
${ticket.customer.email}
. - This convention can also be used when
designing a template (Template >
Adaptive Cards).
This editor should contain an
example of a real ticket's data from your site
in order to successfully test the connection
with your API.
- You do have the option to change the data
values in the editor when testing to see
how the API response changes when
different data is passed to it.
Response
The Response editor
contains the response from the API. It will be
used in the Display section to see what the
data will look like once rendered.
- It can be manually entered or can be
fetched from an API using the settings you
have provided.
Template
Choose a template option for how the
response data will be displayed in the
ticket.
- JSON explorer (default
option) - will print the
response data in a JSON tree format that
can be explored via expanded and collapsed
nodes.
- Adaptive cards - allows you to define how
the JSON data will be rendered using a
second JSON file as a template.
- When designing a template, you have
access to the response data in the
${response} object and Desk data in
the $[desk} object.
- You can learn more about Microsoft's
adaptive cards here.
- Example:
{ "type": "AdaptiveCard", "body": [ { "type": "TextBlock", "spacing": "None", "weight": "NOrmal", "text": "API item title ${response.title}" from user ${desk.ticket.customer.email}, } ], "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.3" }
Display
Preview how the Data Viewer will render the response data.
By default, the data will be displayed in a subsection of the ticket details panel on the right of an individual ticket.
You can also choose to display the data in a modal which will instead display a button in the ticket sidebar. When clicked, the Data Viewer will open in a pop-up window. This option is useful:
- When a large amount of data is expected in the response.
- For APIs with rate limits - a call to the API will not be made unless you click the button.
For more information, see: Using the Desk Data Viewer Integration