translateMessage

Usluga Više kanala za Customer Service nudi paket mogućnosti koje proširuju moć usluge Dynamics 365 Customer Service Enterprise tako da omogućava organizacijama da se odmah povežu i angažuju sa svojim klijentima putem kanala za digitalnu razmenu poruka. Za pristup usluzi Više kanala za Customer Service potrebna je dodatna licenca. Više informacija potražite na stranicama pregleda cena usluge Dynamics 365 Customer Service i plana cena usluge Dynamics 365 Customer Service.

Ovaj metod je potrebno da se implementira u veb resursima. Ovaj metod se zove za svaku poruku razgovora razmenjuju između kupca i agenta, ako je prevod uključen i ako poruka nije prevedena ranije u razgovoru za odredišni jezik.

Važno

Pogledajte ovaj uzorak veb resursa za više informacija o tome kako implementirati translateMessage API.

Sintaksa

function (conversationId, translationConfig): Object

Parametri

Naziv Tip Opis
translationConfig JavaScript objekat Sastoji se od conversationId, messagePayload i translateToC1orC2 parova ključ-vrednost.

Evo strukture parametra translationConfig .


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 
 } 

Evo uzorka parametra conversationConfig .

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

Povratna vrednost

Vraća obećanje koje se rešava na interfejs za implementaciju TranslatedMessageResponse JavaScript objekta.

Objekat interfejsa

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
}

Parametar errorCode u ErrorObject predstavlja greške samo iz sledeće liste.

Poruka o grešci Kod greške Opis
MESSAGE_TOO_LONG 100 Kod greške za veoma dugu poruku koju prevodilačka služba ne može prevesti
LANGUAGE_NOT_SUPPORTED 101 Kod greške za jezik koji nije podržan od strane prevodilačke službe
MESSAGE_NOT_TRANSLATED 102 Kod greške za poruku nije preveden od strane prevodilačke službe
TRANSLATION_SERVICE_LIMIT_EXCEEDED 103 Kod greške ako je ograničenje kvote prekoračeno za uslugu prevođenja
TRANSLATION_FAILED 104 Kod greške ako prevodilačka služba nije uspela da prevede poruku
UNRECOGNIZED_TEXT 105 Kod greške ako tekst nije prepoznat od strane prevodilačke službe
UNRECOGNIZED_ERROR 200 Kod greške ako postoji bilo kakva greška osim navedenog.

Parametar sourceLanguage i destinationLanguage u interfejsu TranslatedMessageResponse predstavlja Locale ID. Više informacija: Locale ID.

Uzorak odgovora

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

Belešku

  • U slučaju izuzetka tokom izvršenja ove metode, Omnichannel za korisnički servis neće ponovo pokušati i umesto toga će prikazati poruku o grešci koja nije uspela u prevodu.
  • Greška prilikom izvršavanja ove metode može biti obaveštena preko errorObject. U slučaju greške, Omnichannel za Customer Service neće ponovo pokušati i umesto toga će prikazati poruku o grešci na osnovu datih kodova grešaka.
  • U slučaju da je vraćeni odgovor nevažeći ili nepotpun, poruka o grešci na baneru prevoda će se pojaviti u kontroli razgovora.
  • Ako se ovaj metod ne sprovede, onda poruka neće biti prevedena i sledeća poruka o grešci će biti prikazana agentu.

translateMessage poruka o grešci.

Dodajte veb resurs za prevođenje u realnom vremenu