Traducir a mensaxe

Multicanle para Customer Service ofrece un conxunto de capacidades que amplían o poder de Dynamics 365 Customer Service Enterprise para permitir ás organizacións conectarse instantáneamente e interactuar cos seus clientes a través de canles como o chat en directo e SMS. Requírese unha licenza adicional para acceder á Multicanle para Customer Service. Para obter máis información, consulte as páxinas Visión xeral dos prezos de Dynamics 365 Customer Service e Plan de prezos de Dynamics 365 Customer Service .

Este método debe ser implementado en recursos web. Este método chácase para cada mensaxe de conversa intercambiada entre o cliente e o axente, se a tradución está activa e se a mensaxe non foi traducida antes na conversa para o idioma de destino.

Importante

Consulte este recurso web de exemplo para obter máis información sobre como implementar a translateMessage API.

Sintaxe

function (conversationId, translationConfig): Object

Parámetros

Nome Tipo Descripción
translationConfig Obxecto JavaScript Consiste en conversationIdpares messagePayload clave-valor translateToC1orC2 .

Esta é a estrutura dos translationConfig parámetros.


export class UserType { 
        public static readonly C1 = "Agent"; //Used if the sender of the message is agent
        public static readonly C2 = "Customer"; //Used if the sender of the message is customer
        public static readonly CONSULT = "Consult Agent"; //Used if the sender of the message is other than agent or customer
} 
 
export class TranslateTo { 
        public static readonly C1 = "Agent"; //Used if message is translated for agent
        public static readonly C2 = "Customer"; //Used if message is translated for customer
} 
 
export class MessageContentType { 
        public static readonly Text = "Text"; //Used if the content type is text
} 
     
interface Sender { 
        userType: UserType;  //Points to any static field in UserType type,Represents the type of the user who is sending this message
} 

interface MessagePayload { 
        content: string;                 //Contains the content to be translated
        contentType: MessageContentType;  //Points to any static field in MessageContentType type,Represents the type of message content. For example: "Text" etc.
        sender: Sender; //Implements Sender interface, Represents the sender of the message
} 

interface translationConfig { 
        conversationId: string;   //Unique Id for conversation in Omnichannel for Customer Service
        messagePayload: MessagePayload;  //Implements MessagePayload interface, Represents the payload for the message to be translated
        translateToC1orC2: TranslateTo;   //Points to any static field in TranslateTo type,Represents for whom the message has to be translated 
 } 

Aquí tes unha mostra do conversationConfig parámetro.

translationConfig = {
  "conversationId": "2b330c52-6844-4d36-8e05-03c78c9681dc",
  "messagePayload": {
    "content": "Hello",
    "contentType": "Text",
    "sender": {
      "userType": "Agent"
    }
  },
  "translateToC1orC2": "Customer"
}

Valor de devolución

Devolve unha promesa que se resolve nun obxecto JavaScript que implementa TranslatedMessageResponse a interface.

Obxecto de interface

export interface ErrorObject{ 
        isError: boolean; //mandatory field, represents true for error while executing this function else no
        errorCode: ErrorCodes; //mandatory field, represents the type of error based on errorCode
} 

export interface TranslatedMessageResponse { 
        translatedMessage: string;  //mandatory field, Contains the translated message
        sourceLanguage: string;       //mandatory field, represents the language locale of the original content 
        destinationLanguage: string;  //mandatory field, represents the language locale of the translated content
        errorObject?: ErrorObject;  //optional field, represents the error object for any error scenarios
}

O errorCode parámetro in ErrorObject representa só os erros da seguinte lista.

Mensaxe de erro Código de erro Descripción
MESSAGE_TOO_LONG 100 Código de erro para unha mensaxe moi longa que o servizo de tradución non pode traducir
LANGUAGE_NOT_SUPPORTED 101 Código de erro para o idioma non soportado polo servizo de tradución
MESSAGE_NOT_TRANSLATED 102 Código de erro para unha mensaxe non traducida polo servizo de tradución
TRANSLATION_SERVICE_LIMIT_EXCEEDED 103 Código de erro se se superou o límite de cota para o servizo de tradución
TRANSLATION_FAILED 104 Código de erro se o servizo de tradución non puido traducir unha mensaxe
UNRECOGNIZED_TEXT 105 Código de erro se o texto non é recoñecido polo servizo de tradución
UNRECOGNIZED_ERROR 200 Código de erro se hai algún erro distinto do listado.

O sourceLanguage parámetro and destinationLanguage na TranslatedMessageResponse interface representa un ID de localización. Máis información: ID de localización.

Mostra de resposta

{
  "translatedMessage": "Hola",
  "destinationLanguage": "3082",
  "errorObject": {
    "isError": false,                             
    "errorCode": null
  },
  "sourceLanguage": "3082"
}

Nota

  • En caso de excepción durante a execución deste método, Omnicanal para o Servizo de Atención ao Cliente non volverá intentar e, no seu lugar, mostrará unha mensaxe de erro de tradución fallada.
  • Un erro ao executar este método pode ser notificado a través errorObjectde . En caso de erro, Omnicanal para o Servizo de Atención ao Cliente non volverá intentar e mostrará a mensaxe de erro baseada nos códigos de erro proporcionados.
  • No caso de que a resposta devolta non sexa válida ou incompleta, aparecerá unha mensaxe de erro no banner de tradución no control de conversa.
  • Se este método non está implementado, a mensaxe non será traducida e mostrarase a seguinte mensaxe de erro ao axente.

Mensaxe de erro translateMessage.mensaxe

Engadir un recurso web para a tradución en tempo real