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 Types
There are a number of app targets in Deskpro, here's a list of them:
ticket_sidebar
- appears alongside a ticketuser_sidebar
- appears alongside a user in the CRMorganisation_sidebar
- appears alongside an organisation in the CRMcontent_knowledge_base_sidebar
- appears next to a knowledge base article in the help centercontent_news_sidebar
- appears next to a news articlecontent_download_sidebar
- appears next to a downloadcontent_guide_topic_sidebar
- appears next to a guide articlecommunity_topic_sidebar
- appears next to a community topicglobal
- 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
请登录或注册以提交评论。