跳到主要内容

Target Actions

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

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.

image.png

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 ActionsCopy link to Listening for Target Actions to clipboard

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".

有帮助没有帮助
下一个页面App Settings
上一个页面Targets

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