prevediPoruka

Svi kanali za Customer Service pruža niz mogućnosti koje proširuju snagu sustava Dynamics 365 Customer Service Enterprise kako bi omogućila tvrtkama i ustanovama trenutačno povezivanje i interakciju s klijentima putem kanala za digitalnu razmjenu poruka. Za pristup rješenju Svi kanali za Customer Service potrebna je dodatna licenca. Dodatne informacije potražite na stranicama Pregled cijena sustava Dynamics 365 Customer Service i Plan cijena za Dynamics 365 Customer Service.

Ovu metodu je potrebno implementirati u web resursu. Ova se metoda poziva za svaku poruku razgovora razmijenjenu između klijenta i agenta, ako je prijevod uključen i ako poruka nije prevedena ranije u razgovoru za odredišni jezik.

Važno

Pogledajte ovaj ogledni web-resurs za više informacija o implementaciji API-ja translateMessage .

Sintaksa

function (conversationId, translationConfig): Object

Parametri

Ime/naziv Tip Opis
translationConfig JavaScript objekt Sastoji se od conversationIdparova , messagePayload i translateToC1orC2 ključ-vrijednost.

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 primjera parametra conversationConfig .

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

Povratna vrijednost

Vraća obećanje koje se razlučuje na sučelje za implementaciju TranslatedMessageResponse JavaScript objekta.

Objekt sučelja

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 pogreške samo sa sljedećeg popisa.

Poruka o pogrešci Kôd pogreške Opis
MESSAGE_TOO_LONG 100 Kôd pogreške za vrlo dugu poruku koju prevoditeljska služba ne može prevesti
LANGUAGE_NOT_SUPPORTED 101 Kôd pogreške za jezik koji usluga prevođenja ne podržava
MESSAGE_NOT_TRANSLATED 102 Kôd pogreške za poruku koju nije preveo prevoditeljski servis
TRANSLATION_SERVICE_LIMIT_EXCEEDED 103 Kôd pogreške ako je prekoračeno ograničenje kvote za uslugu prevođenja
TRANSLATION_FAILED 104 Kôd pogreške ako usluga prevođenja nije uspjela prevesti poruku
UNRECOGNIZED_TEXT 105 Kôd pogreške ako prevoditeljska služba ne prepozna tekst
UNRECOGNIZED_ERROR 200 Kôd pogreške ako postoji pogreška koja nije navedena.

Parametar sourceLanguage and destinationLanguage u TranslatedMessageResponse sučelju predstavlja ID regionalne sheme. Dodatne informacije: ID regionalne sheme.

Uzorak odgovora

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

Napomena

  • U slučaju iznimke tijekom izvršavanja ove metode, Svi kanali za Customer Service neće ponovno pokušati i umjesto toga prikazat će poruku o pogrešci prijevoda koja nije uspjela.
  • Pogreška tijekom izvođenja ove metode može se obavijestiti putem errorObject. U slučaju pogreške, Svi kanali za Customer Service neće ponovno pokušati i umjesto toga prikazat će poruku o pogrešci na temelju navedenih kodova pogrešaka.
  • U slučaju da je vraćeni odgovor nevažeći ili nepotpun, poruka o pogrešci na natpisu prijevoda pojavit će se u kontroli razgovora.
  • Ako se ova metoda ne implementira, poruka se neće prevesti i agentu će se prikazati sljedeća poruka o pogrešci.

translateMessage poruka o pogrešci.

Dodavanje web-resursa za prijevod u stvarnom vremenu