Zum Hauptinhalt springen

Target Actions

in Apps
Autorenliste
veröffentlicht: 1. Feb. 2022|Letzte Aktualisierung: 21. Feb. 2022

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

HilfreichNicht hilfreich
nächste SeiteApp Settings
vorherige SeiteTargets

Bitte loggen Sie sich ein oder melden Sie sich an, um einen Kommentar zu hinterlassen.