...
What | Value |
---|---|
Method | POST |
URL | "/editor/task/ID/workflow" where the ID is the tasks DB id. |
Parameter "trigger" | the trigger to be triggered, in the example above "notifyAllUsersAboutTaskAssociation" |
Using callbacks with translate5 workflow actions
With the triggerCallbackAction URL configuration it is possible to configure translate5 to call an outside URL (callback) on a lot of different events in translate5.
In the example (Remote callback when all users finish their jobs
...
In the example bellow ) below it is shown how workflow trigger with remote callback URL can be configured after all users did finish there jobs in a task. The parameters field must be json string and all invalid content there will be ignored.
Analogous to this callbacks can also be used for other workflow events and actions.
Code Block | ||||
---|---|---|---|---|
| ||||
# id, workflow, trigger, inStep, byRole, userState, actionClass, action, parameters, position, description '37', 'default', 'handleAllFinishOfARole', NULL, NULL, NULL, 'editor_Workflow_Actions', 'triggerCallbackAction', '{"url":"https://mytestroute.de/test","params":{"username":"myusername","password":"mypass" }}', '0', 'Send a request to the configured url parameter with the task and task user assoc data. If "params" field is provided in the parameters field, this will be applied to in the request json.' |
...
Alongside with the custom "params" also the task data and the task-user association will be present in the submitted post data, once the configured callback is triggered.
task →translate5 task info
...
Code Block | ||||
---|---|---|---|---|
| ||||
{ "username": "myusername", "password": "mypass", "task": { "id": 1919, "entityVersion": "124", "modified": "2022-06-08 11:35:10", "taskGuid": "{876c2173-58aa-4220-865b-8454a5470fd6}", "taskNr": "", "foreignId": "", "taskName": "Task-de-en.html - de \/ en", "foreignName": "", "sourceLang": "4", "targetLang": "5", "relaisLang": "0", "locked": null, "lockingUser": null, "state": "open", "workflow": "default", "workflowStep": "14", "workflowStepName": "reviewing", "pmGuid": "{e6828cdf-2ee0-4a25-af0a-92e6f060e9eb}", "pmName": "Manager, Project (manager)", "wordCount": "11", "userCount": "1", "orderdate": "2022-06-07 00:00:00", "enddate": null, "referenceFiles": "0", "terminologie": "0", "enableSourceEditing": "0", "edit100PercentMatch": "0", "lockLocked": "1", "qmSubsegmentFlags": "{\"qmSubsegmentFlags\":[{\"text\":\"Accuracy\",\"id\":1,\"children\":[{\"text\":\"Mistranslation\",\"id\":2,\"children\":[{\"text\":\"Terminology\",\"id\":3}]},{\"text\":\"Omission\",\"id\":4},{\"text\":\"Addition\",\"id\":5},{\"text\":\"Untranslated\",\"id\":6}]},{\"text\":\"Fluency\",\"id\":7,\"children\":[{\"text\":\"Register\",\"id\":8},{\"text\":\"Style\",\"id\":9},{\"text\":\"Inconsistency\",\"id\":10},{\"text\":\"Spelling\",\"id\":11},{\"text\":\"Typography\",\"id\":12},{\"text\":\"Grammar\",\"id\":13},{\"text\":\"Locale violation\",\"id\":14},{\"text\":\"Unintelligible\",\"id\":15}]},{\"text\":\"Verity\",\"id\":16,\"children\":[{\"text\":\"Completeness\",\"id\":17},{\"text\":\"Legal requirements\",\"id\":18},{\"text\":\"Locale applicability\",\"id\":19}]}],\"severities\":{\"critical\":\"Critical\",\"major\":\"Major\",\"minor\":\"Minor\"}}", "emptyTargets": "0", "importAppVersion": "development", "customerId": "1", "usageMode": "simultaneous", "segmentCount": "3", "segmentFinishCount": "3", "taskType": "projectTask", "projectId": "1918", "diffExportUsable": "0", "description": "", "created": "2022-06-07 14:23:02" }, "tua": { "id": "1492", "taskGuid": "{876c2173-58aa-4220-865b-8454a5470fd6}", "userGuid": "{e6828cdf-2ee0-4a25-af0a-92e6f060e9eb}", "state": "finished", "role": "reviewer", "workflowStepName": "reviewing", "workflow": "default", "segmentrange": "", "usedState": null, "isPmOverride": "0", "deadlineDate": "2022-06-10 19:55:12", "assignmentDate": "2022-06-07 14:24:07", "finishedDate": "2022-06-07 17:12:29", "trackchangesShow": "1", "trackchangesShowAll": "1", "trackchangesAcceptReject": "1" } } |
Webhooks in translate5 - flexibly overwriting callbacks
Base information you need to know, when configuring webhooks in translate5 UI is the above paragraph "Using callbacks with translate5 workflow actions".
With the system config runtimeOptions.task.workflow.webhooks it is possible to overwrite such a callback URL for a certain workflow event via UI. And to overwrite/set this on client level in the client-specific configuration in the UI.
Only draw-back: In the UI it is currently only possible to configure callbacks for the action handlers as they are configured in the workflow action configuration. If the same action handler (for example handleAllFinishOfARole) is defined for two different cases (for example, when workflow step review is finished and when workflow step Review2 is finished), the callback defined (and possibly overwritten by client) will be called for both cases. So far it is not possible to set separate callback URLs for such different cases in the UI-based configuration. This is only possible directly in the workflow_action table. Yet there it is not possible to overwrite it on client level. This means, overwriting on client level is only meaningful considering those restrictions.
The config option name for the UI system config (client overwritable) is runtimeOptions.task.workflow.webhooks
The UI component looks like this:
Warning |
---|
Proper entry with a specific trigger for the needed callback must be configured / exist in workflow_action table before! |
Examples of the predefined triggers:
Trigger | In Step | By Role | User State | Action Class | Action | Parameters |
---|---|---|---|---|---|---|
handleAllFinishOfARole | reviewing | reviewer | finished | editor_Workflow_Actions | triggerCallbackAction | |
handleAfterImport | reviewing | reviewer | finished | editor_Workflow_Actions | triggerCallbackAction |
After defining triggerCallbackAction for a specific trigger in the workflow_action table, the triggered URL can be overwritten in the config.
Workflow Trigger in the application
...