Add Live Transcripts of a Customer's Messages During a Phone Call
The FeedLiveTranscript API should be executed from the engagement context, which is available from the startComm event action response. Once the engagement context is available, create the request object for FeeLiveTranscript API and set the required properties (message, message id, state, role). The role should be set as CUSTOMER for adding the customer's transcript messages. Once this API is executed, the customer's transcript message will be rendered in the fusion engagement panel.
Here's a Typescript example:
// Step 1: Initialize the framework
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
// Step 2: Get the proper context - engagementContext in this case
const mcaContext: IMultiChannelAdaptorContext = await frameworkProvider.getMultiChannelAdaptorContext();
const phoneContext: IPhoneContext = await mcaContext.getCommunicationChannelContext('PHONE') as IPhoneContext;
const startCommRequest: IMcaStartCommEventActionRequest = frameworkProvider.requestHelper.createPublishRequest('startCommEvent') as IMcaStartCommEventActionRequest;
// TODO set eventId and InData in startComm request
startCommRequest.setAppClassification('ORA_SERVICE');
const startCommOperationResponse: IMcaStartComActionResponse = await phoneContext.publish(startCommRequest) as IMcaStartComActionResponse;
const engagementContext: IEngagementContext = startCommOperationResponse.getResponseData().getEngagementContext();
// Step 3: Create request object
var requestObject: IMcaFeedLiveTranscriptActionRequest = frameworkProvider.requestHelper.createPublishRequest('FeedLiveTranscript') as IMcaFeedLiveTranscriptActionRequest;
requestObject.setMessageId('1234');
requestObject.setMessage('Vertical lines on phone display');
requestObject.setRole('END_USER'); // Possible values: AGENT, END_USER
requestObject.setState('CLOSED'); // Possible values: STARTED, INPROGRESS, CLOSED
// Step 4: Execute the API
await engagementContext.publish(requestObject);
Here's a JavaScript example:
// Step 1: Initialize the framework
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID', 'v1');
// Step 2: Get the proper context - engagementContext in this case
const mcaContext = await frameworkProvider.getMultiChannelAdaptorContext();
const phoneContext = await mcaContext.getCommunicationChannelContext('PHONE');
const startCommRequest = frameworkProvider.requestHelper.createPublishRequest('startCommEvent');
// TODO set eventId and InData in startComm request
startCommRequest.setAppClassification('ORA_SERVICE');
const startCommOperationResponse = await phoneContext.publish(startCommRequest);
const engagementContext = startCommOperationResponse.getResponseData().getEngagementContext();
// Step 3: Create request object
var requestObject = frameworkProvider.requestHelper.createPublishRequest('FeedLiveTranscript');
requestObject.setMessageId('1234');
requestObject.setMessage('Vertical lines on phone display');
requestObject.setRole('END_USER'); // Possible values: AGENT, END_USER
requestObject.setState('CLOSED'); // Possible values: STARTED, INPROGRESS, CLOSED
// Step 4: Execute the API
await engagementContext.publish(requestObject);