Zendesk - Love your helpdesk.

we are hiring!
  1. Home
  2. Tour
  3. Extras
  4. Buzz

Widgets

Widgets are html fragments that can be embedded directly on any page of your help desk. Use widgets to integrate external data in your help desk interface. You can furthermore access all of the data in your help desk via JSON, mash-up with external data and even replace existing elements in the help desk layout.

For advanced usage, see the Javascript Resource API

Text placeholders

You can use text placeholder in your widgets to include information about the selected objects in your help desk pages. If you wanted to insert the name of the user who is logged in to the system you could insert {{current_user.name}}.

Examples

Hello user

Hi {{current_user.name}}

See the Widget Text Placeholders Documentation for more info on the available placeholders.

Accessing the REST API

You can access all data in your help desk directly from the widget via JSON. This example lists the number of users in your help desk, and displays the name of the first user. The data is shown on the page in the inner HTML of the div with ID “active-views”. You can place the content of your widget in any div with an ID!

Widget access to all data in your help desk via JSON

<script>
  new Ajax.Request('/users.json', {
    method:'get',
    asynchronous: true,
    onSuccess: function(transport){
      var obj = transport.responseText.evalJSON();
      $('active-views').innerHTML = '<p>' + obj.length + ' users in your help desk.'
        + ' First user is '
        + obj[0].name + '</p>'
    }
  });
</script>

Integrating data from and to your enterprise

If you have pre-populated or updated the user database via REST, you can utilize the attribute {{current_user.external_id}}
for the internal user ID for your enterprise, thus using javascript calls in the widget to fetch and present additional data from your repositories – e.g. license or asset data for the current user.

Integrating user data from and to your enterprise

<script type="text/javascript"
src="https://database.your_enterprise.com/get_user_assets.php?id={{current_user.external_id}}">
</script>

This example calls an internal method at your enterprise. The method returns javascript listing users assets. This could also be done with an iframe returning plain HTML from your enterprise.