Skip to content

Workflow Step Type

This module allows you to add custom workflow step.

index.js
const crowdinModule = require('@crowdin/app-project-module');
const app = crowdinModule.express();
const configuration = {
baseUrl: 'https://123.ngrok.io',
clientId: 'clientId',
clientSecret: 'clientSecret',
name: 'Sample App',
identifier: 'sample-app',
description: 'Sample App description',
dbFolder: __dirname,
imagePath: __dirname + '/' + 'logo.png',
workflowStepType: [
{
name: 'Translation Delay',
description: 'Delays strings until the file is fully translated',
boundaries: {
input: {
title: 'Strings',
ports: ['translated']
},
outputs: [
{
title: 'Strings',
port: 'translated'
}
],
},
settingsUiModule: {
formSchema: {
"title": "Workflow Step Settings",
"type": "object",
"required": ["delayHours"],
"properties": {
"delayHours": {
"type": "number",
"title": "Delay (hours)",
"default": 24
}
}
},
formUiSchema: {
"ui:submitButtonOptions": {
"submitText": "Save Settings"
}
}
},
onStepSettingsSave: async ({ organizationId, projectId, stepId, workflowId, settings, context, client }) => {
await crowdinApp.saveMetadata(
`form-data-${organizationId}-${projectId}-${stepId}`,
settings,
organizationId,
);
},
onDeleteStep: async ({ organizationId, projectId, stepId, workflowId, context, client }) => {
await crowdinApp.deleteMetadata(`form-data-${organizationId}-${projectId}-${stepId}`);
}
}
]
};
const crowdinApp = crowdinModule.addCrowdinEndpoints(app, configuration);
app.listen(3000, () => console.log('Crowdin app started'));
ParameterTypeRequiredDescription
namestringYesWorkflow step name.
descriptionstringNoWorkflow step description.
boundariesobjectYesDefines the input and output ports for the workflow step. See Boundaries.
editorModestringNoEditor mode for viewing strings. See Editor Mode.
settingsUiModuleobjectNoSettings UI module configuration. See Settings UI Module.
onStepSettingsSavefunctionYesCalled after saving workflow for custom data management. See details below.
onDeleteStepfunctionYesCalled after deleting a step for custom data management. See details below.

Defines the input and output ports for the workflow step. The boundaries parameter includes one input and up to two outputs.

The input and outputs can take the following port values:

  • false - Used for branching.
  • true - Used for branching.
  • untranslated - Represents an untranslated string.
  • translated - Represents a translated string.
  • approved - Represents an approved string.
  • skipped - Represents a string not sent to a vendor (applicable only for vendor-specific blocks).
  • all - Represents any output.
  • initial - Used for connecting to the start step.

Defines the editor mode for the workflow step. To allow view strings in the editor, this attribute should be defined. Read more about the editor modes.

Available values:

  • comfortable - Comfortable mode.
  • side-by-side - Side-by-side mode.
  • multilingual - Multilingual mode.

Object with the settings UI module configuration. This optional parameter allows you to define a UI for workflow step settings.

You can use either a low-code approach with formSchema and formUiSchema, or provide your own custom UI with uiPath and fileName. Read more in the User Interface documentation.

This optional function is called after saving the workflow for custom data management.

  • organizationId - Crowdin organization ID.
  • projectId - Crowdin project ID.
  • stepId - Workflow step ID.
  • workflowId - Workflow ID.
  • settings - formData object .
  • context - Context object.
  • client - Crowdin API client.

This optional function is called after saving the workflow if a step has been deleted, allowing for custom data management.

  • organizationId - Crowdin organization ID.
  • projectId - Crowdin project ID.
  • stepId - Workflow step ID.
  • workflowId - Workflow ID.
  • context - Context object.
  • client - Crowdin API client.

If you want to receive a list of strings that are processed in a workflow step, you need to declare a webhooks module and listen to the string.status_on_step.recalculation_triggered event.

index.js
webhooks: [
{
events: ['string.status_on_step.recalculation_triggered'],
callback({client, credentials, events}) {
console.log('String status on step event:', events);
}
}
]