OnAfterMessageSent Event
After opening an object, such as a service request, an agent will be able to open a Compose Message smart action.
A compose message panel is opened where the agent can send messages. This event is launched before firing the API request to send a message for a particular record. The user must pass the message type they intend to subscribe this event for. This event is now supported on the Service Request object and the Supported Message Compose smart action types.
In the event request, the user must pass the message type which they intend to subscribe this event for.
Here are the Compose Message smart actions types which must be passed while subscribing this event:
- Compose Internal note (Message type: ORA_SVC_INTERNAL_NOTE)
- Compose Email (Message type: ORA_SVC_EMAIL )
- Compose Web Message (Message type: ORA_SVC_WEB)
- Capture Customer Message(Message type: ORA_SVC_CUSTOMER_ENTRY)
- Compose Message (Super set of all the previous. Message type: ANY)Note:
OnAfterMessageSend
is an event listenable fromRecordContext
.
Here's a Typescript example:
/// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID');
const tabContext = await frameworkProvider.getTabContext();
const recordContext = await tabContext.getActiveRecord();
const requestObject: IComposeMessageEventRequest = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusOnAfterMessageSentEvent') as IComposeMessageEventRequest;
requestObject.setMessageType('ORA_SVC_WEB');
recordContext.subscribe(requestObject, (message: IEventResponse) => {
const response: IComposeMessageEventResponse = message as IComposeMessageEventResponse;
const messageType: string = response.getResponseData().getMessageType();
});
Here's a JavaScript example:
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID');
const tabContext = await frameworkProvider.getTabContext();
const recordContext = await tabContext.getActiveRecord();
const requestObject = frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusOnAfterMessageSentEvent');
recordContext.subscribe(requestObject, (response) => {
const messageType = response.getResponseData().getMessageType();
});