Integrate with a translation service provider

  • Release version: Washingtondc
  • Updated May 6, 2025
  • 2 minutes to read
  • Integrate with a third-party translation provider of your choice for machine translation of user-generated text.

    Before you begin

    Role required: admin

    Procedure

    1. Create subflows to detect the language of the input text, and translate the input text by using Integration Hub subflows, actions, and connections and credentials.
      For more information, see Flow Designer.
      1. Map error codes from your machine translation provider to the error codes and standardized error messages supported by ServiceNow.
        Table 1. Standard error codes and message
        Error code Error message
        40050 Error code to populate error messages from the machine translation provider instead of standardized error messages.
        40051 Unknown error occurred.
        40052 Text ('text' field) has exceeded its maximum length.
        40053 Source language is invalid.
        40054 Target language is invalid.
        40055 Request is not authorized because credentials are missing or invalid.
        40056 Text cannot be translated to target languages.
      2. Ensure that the inputs and output fields are in the following format for subflows.
        Note:
        While you create subflows, you can refer to the subflows that are available by default if required. For example, Detect Language [detect_language_v3] and Translate Text To Multiple Languages [translate_text_to_multiple_languages_v3].
        Table 2. Detect subflow
        Field name Description Type
        Inputs
        texts Input texts whose language should be detected.

        In the Washington DC release, version v3 supports bulk detection- detection of multiple texts input in a single string.

        Array.String
        Outputs
        detections Information about the code and confidence of the languages detected by the translator and their respective alternatives, error codes, and error messages.
        • Code: Language code of the detected language as specified by the translation service provider.
        • Confidence: Value that indicates the confidence in the result. The value is between zero and one. A low value indicates a low confidence.
        For example, French text with confidence of 0.93
        { 'code' : 'fr',  'confidence' : '0.93'  }

        For more information refer to the getDetectedLanguages section of DynamicTranslation - Scoped.

        Array.Object. Each element of the Object is a String value.
        status Status of the request. Choice
        Table 3. Translate subflow
        Field name Description Type
        Inputs
        texts Texts to be translated.

        In the Washington DC release, version v3 supports bulk translation- translation of multiple texts input in a single string.

        Array.String
        target_languages Array of language codes to which the text needs to be translated.
        For example,
        ['fr','it']
        Array String. Each element of the array is a String value.
        source_language Language code of the source text.
        For example,
        en
        String
        additional_parameters Array of additional parameters.
        For example,
        [{'parameter_name': 'textType', 'parameter_value': 'html'}]
        Array.Object. Each element of the array is an Object with String values.
        Outputs
        translations Translated texts in the specified target languages. Each element of the array is an Object containing target language and the translated text.
        For example,
        [ 
        {'target_language':'fr', 'translated_text':'Bonjour'}, 
        {'target_language':'it', 'translated_text':'ciao'} 
        ]
        

        For more information refer to the getTranslations section of DynamicTranslation - Scoped.

        Array.Object. Each element of the array is an Object with String values.
        status Status of the request. Choice
        Note:
        Ensure that the Run As field is set to User who initiates session in the flow properties.
    2. Create a translator configuration and activate it.
      For more information, see Create a custom translator configuration.