Setting up new apps

Creating the app files

You can create app files with the Zendesk App Tools (ZAT), the App Scaffold, or manually.

Using ZAT

You can create a basic set of files for your app with the Zendesk App Tools (ZAT). If you haven't installed the tools yet, see Installing and using the Zendesk Apps Tools.

Run the following command to create the files:

$ zat new

The tool prompts you for information to populate the app's manifest.json file. See Manifest reference. The tool also asks you if you want to enter an iframe URI. If you leave the URI blank, ZAT will create a basic HTML page for you identical to this example on Github.

Using the App Scaffold

More experienced web developers can use the open-source Zendesk app scaffold on Github as a starting point. See the readme for details about various features and technologies used in the scaffold.

You can either download the Zendesk app scaffold repo or run the zat new --scaffold command to create a scaffold app.

Important: Zendesk does not provide support for any third-party technology used in the scaffold, nor can Zendesk debug custom scaffold configurations or code.

Using Zendesk Garden

While you can use any custom CSS or front-end framework for the look and feel of your app, Zendesk recommends using Zendesk Garden. Zendesk Garden is designed to be a common baseline of styles and components between all Zendesk products. If you want your app to match the Zendesk look and feel, use Zendesk Garden CSS classes and React components in your app.

You can import Zendesk Garden CSS classes and React components into your app's HTML template from the jsDelivr CDN. See https://www.jsdelivr.com/?query=zendeskgarden. The jsDelivr files are npm packages that can also be installed from npm. See https://www.npmjs.com/search?q=zendeskgarden.

For more information about the CSS classes and React components in Zendesk Garden, see garden.zendesk.com or the demo app.

File requirements

The following folder structure and files must be included in an app to install the app successfully in a Zendesk product:

assets/
  logo.png
  logo-small.png
translations/
  en.json
manifest.json

Everything else is optional. For example, you can host the rest of the app on a remote app server, including the HTML files to be iframed into the Zendesk product.

The following are brief descriptions of the required files:

  • manifest.json - Describes and configures the app. See Manifest reference.

  • translations/en.json - A standard English translation file. See Internationalization.

  • assets/logo-small.png - Small icon displayed in the header of the app. You can still upload and install the app without it, but a default image will appear in the interface. See App icons for the image specifications.

  • assets/logo.png - Large icon displayed in the Zendesk admin pages for managing apps. You can still upload and install the app without it but a broken image icon will appear in the interface. See App icons and Top bar and nav bar icon for the image specifications.

  • assets/icon_*_bar.svg - Every nav_bar or top_bar app requires a icon_nav_bar.svg or icon_top_bar.svg file respectively. See App icons for the image specifications.

If you plan on making the app available in the Zendesk Apps Marketplace (as opposed to creating a private app to run only in your Zendesk account), additional branding assets may be required. See Branding.

Setting the app location

You must declare where you want your app to appear in each product interface with the location property in manifest.json.

For example, in Zendesk Support you can place the app in the panel on the right side of the ticket in the agent interface. The framework calls this location the ticket_sidebar (or the new_ticket_sidebar in the case of the new ticket page).

"location": {
  "support": {
    "ticket_sidebar": "assets/iframe.html"
  }
},

For available locations, see:

Some framework APIs are only available to apps in certain locations. For example, only apps appearing on the ticket page can get and set ticket properties, and listen for changes to the ticket.

If you want the app to appear in multiple locations in the product, add the locations to the product object:

  "location": {
    "support": {
      "ticket_sidebar": "assets/iframe.html",
      "new_ticket_sidebar": "assets/iframe.html?location=new_ticket_sidebar",
      "nav_bar": "https://dashboard.myapp.com/nav_bar",
      "top_bar": "https://dashboard.myapp.com/top_bar"
    }
  },

An app can exist in multiple Zendesk products. The example belows shows an app that could appear in the Zendesk Support ticket_sidebar and the Zendesk Chat chat_sidebar.

"location": {
  "support": {
    "ticket_sidebar": "assets/iframe.html",
  },
  "chat": {
    "chat_sidebar": "assets/chat_iframe.html"
  }
},

You must specify an object rather than a string to use certain advanced features that are enabled on a per-location basis. Set the location properties in the object.

Example:

  "location": {
    "support": {
      "background": {
        "url": "assets/iframe.html"
      },
      "ticket_sidebar": {
        "autoLoad": false
      }
    }
  },

For available location properties, see the manifest location reference.

The URL paths can be absolute if pointing to an external page, or relative if pointing to a html file in the assets folder.

Note: Use https for all remote, production-ready URL paths. You can use http during development.

Defining installation settings

You can define settings you want product admins to set for the app during or after installing the app. While settings are completely optional, they're simple to set up and use. The framework even auto-generates a settings page for you.

Note: If you are building a multi-product app, you cannot currently specify product-specific settings.

Settings are defined by the parameters property in the manifest file. The property consists of a list of JSON objects representing the settings you want the admin to set.

Example:

"parameters": [
  {
    "name": "subdomain",
    "type": "text",
    "required": true,
    "secure": false,
    "default": "yoursubdomain"
  },
  {
    "name": "token",
    "type": "text",
    "required": true,
    "secure": true
  },
  {
    "name": "useSSL",
    "type": "checkbox"
  }
]

You can retrieve the setting values in your app with client.metadata():

var client = ZAFClient.init();
client.metadata().then(function(metadata) {
  console.log(metadata.settings);
});

You can also use settings to customize the manifest.json file on a per installation basis. To specify a setting value in the manifest, use double curly brackets. Example:

...
"domainWhitelist": ["www.teachmyapi.com", "{{setting.subdomain}}.herokuapp.com"],

For more information about domainWhitelist, see Using secure settings.

Setting properties

Each object in the parameters list represents a setting and can have the following properties:

name

The name of the setting.

"name": "subdomain",

Because you use this value in your app code, make sure you name it appropriately.

required

A boolean value that determines if the user must define the setting or not to install the app. Optional.

"required": true,
default

Specifies a default value to enter for the setting if the user doesn't specify one. Optional.

"default": "yoursubdomain",

The default value is used to populate the parameter form field when the admin installs or updates the app. However, it will not take effect for existing parameters where a value has already been set. Don't use the default value as a fallback value. If your app needs a fallback value, implement it in the app.

secure

Use the optional "secure" property when you don't want users to see sensitive information in the parameters when making HTTP requests. Since a lot of apps make HTTP requests to get or set information, any agent can view this data in their browser if the setting is not secure.

"secure": true,

For details, see Using secure settings.

type

Specifies the control to use on the auto-generated settings page for the user.

"type": "text",

The framework generates an HTML settings page for users installing the app. The following controls are available:

Type Control
text A single-line input field
password A masked single-line input field
checkbox A single checkbox
url A single-line input field, validated for correct URL syntax
number A single-line input field, validated to include only numbers
multiline A multi-line textarea. User input is limited to 64Kb
hidden A parameter never shown to the user on the settings page
Creating a settings page for users

Users need some kind of user interface to enter the settings when installing the app or to edit the settings after installing the app. The framework generates an HTML settings page based on the settings defined in the manifest file. Setting type controls on the page are rendered in the same order as the settings in the manifest file. Example:

settings

Asterisks indicate required fields.

The maximum length of any setting is 64kB. Exceeding this limit will result in an error.

You can define the setting labels displayed on the generated settings page. The labels and help text in the example above are extracted from the translation file. To translate parameters and add help text, add a parameters property to the app object in your translations files as follows:

{
  "app": {
    "parameters": {
      "subdomain" : { "label": "Subdomain" },
      "token"     : { "label": "Token" },
      "useSSL"    : { "label": "Use SSL?", "helpText": "Use SSL for a secure connection." }
    }
  }
}
Updating settings

Sometimes you want to change and save a setting from within the app. You can do it with the following REST API endpoint:

PUT /api/v2/apps/installations/{id}.json

For more information, see Update an App Installation in the REST API docs.

Note that only admins can update settings, not agents.

Defining test settings

When testing your app locally, you might need to specify some installation settings. Because you haven't installed the app yet, the settings don't exist yet. If you start the local server with zat server, ZAT will ask interactively for the values of all the settings specified in the manifest.json file. However, you might prefer to specify the settings in a JSON or YAML file.

  1. Create a JSON or YAML file with your settings. The keys in the file should be the same as in your manifest file.
  2. Start the server with zat server -c [$CONFIG_FILE], where $CONFIG_FILE is the name of your JSON or YAML file. The default filename is settings.yml. You don't need to specify it in the command if your file uses that name.

If manifest.json contains the following settings:

"parameters": [
  {
    "name": "mySetting"
  },
  ...
],

Then you can specify the settings in a file as follows:

./settings.json

{
  "mySetting": "test value"
}

or

./settings.yml

mySetting: test value

With the first file, you'd start the server with zat server -c settings.json. With the second file, you'd start it with zat server -c.