跳到主要内容

Targets

在 Apps 中
作者列表
已发布: 2022年2月1日|最后更新: 2022年2月10日

As mentioned in the anatomy of an app section, targets are the places in Deskpro where your app will appear. Targets are a little more than this though, they also dictate the app entrypoint used for each target, as well as options about the target itself, e.g. target actions. The data passed to your app, or the app "context" may be different for each target too, e.g. "ticket_sidebar" targets will provide information about the ticket currently being viewed.

Target TypesCopy link to Target Types to clipboard

There are a number of app targets in Deskpro, here's a list of them:

  • ticket_sidebar - appears alongside a ticket

  • user_sidebar - appears alongside a user in the CRM

  • organisation_sidebar - appears alongside an organisation in the CRM

  • content_knowledge_base_sidebar - appears next to a knowledge base article in the help center

  • content_news_sidebar - appears next to a news article

  • content_download_sidebar - appears next to a download

  • content_guide_topic_sidebar - appears next to a guide article

  • community_topic_sidebar - appears next to a community topic

  • global - appears globally

You can add as many targets as you like, and each one might point to a different entrypoint in your app. Please note though that the data passed to your app will change depending on the target.

To configure targets, add them to the targets section of your manifest.json file in the root of your app package. A simple example is as follows:

# /manifest.json { // ... "targets": [ { "target": "ticket_sidebar", "entrypoint": "index.html" } ] }
copy

The above example includes a single target and associated endpoint, index.html. This means that the app will appear alongise tickets, showing the index.html file in the root of your app package. Note that you could specify a path relative to the root of your app package for an entrypoint - but the entrypoint must be a file and not a directory.

# /manifest.json { // ... "targets": [ { "target": "ticket_sidebar", "entrypoint": "ticket-entrypoint.html" }, { "target": "user_sidebar", "entrypoint": "user-entrypoint.html" } ] }
copy

In the above example we've specified two targets for the app. This is a slightly more uncommon configuration as each target specifies a different entrypoint file. This could be handy if you wanted to have two distinct apps in one package, one for each target. You could also specify a URL parameter for the entrypoints if necessary:

# /manifest.json { // ... "targets": [ { "target": "ticket_sidebar", "entrypoint": "index.html?page=tickets" }, { "target": "user_sidebar", "entrypoint": "index.html?page=users" } ] }
copy
有帮助没有帮助
下一个页面Target Actions
上一个页面App Manifest

请登录或注册以提交评论。