Target actions allow you to add controls to other, designated parts of Deskpro. An example of this is adding a button to the ticket actions menu as we saw in the anatomy of an app guide.

In this example, we've add a button to the ticket actions menu. To configure this, add the following options to your ticket sidebar target:
{
// ...
"targets": [{
"target": "ticket_sidebar",
"entrypoint": "index.html",
"options": {
"actions": {
"linkTicket": {
"type": "ticket_addition",
"title": "Shortcut Story",
"description": "Link ticket to Shortcut story"
}
}
}
}]
} copy
Deskpro currently supports the following app target action types:
target:
ticket_sidebar
-> type:ticket_addition
- add a button to the ticket additions/actions menu
Listening for Target Actions
You can then listen for a target action from within your app using the useDeskproAppEvents()
hook:
import {
TargetAction,
useDeskproAppEvents,
} from "@deskpro/app-sdk";
// ...
export const MyComponent = () => {
useDeskproAppEvents({
onTargetAction(action: TargetAction) {
console.log(action);
},
});
// ...
}; copy
You will be passed details of the target action pressed, including the name we gave it, "linkTicket".
请登录或注册以提交评论。