@ovotech/genesys-web-messaging-tester
Version:
72 lines (71 loc) • 2.12 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.webMessagePayloads = void 0;
/**
* Payloads taken from real interactions
*/
exports.webMessagePayloads = {
sessionResponse: () => ({
type: 'response',
class: 'SessionResponse',
code: 200,
body: { connected: true, newSession: true },
}),
inboundStructuredMessage: (text, date) => ({
type: 'message',
class: 'StructuredMessage',
code: 200,
body: {
originatingEntity: '',
text,
direction: 'Inbound',
id: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
channel: {
time: date.toISOString(),
messageId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
},
type: 'Text',
metadata: {
correlationId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
},
},
}),
outboundTextStructuredMessage: (text, date) => ({
type: 'message',
class: 'StructuredMessage',
code: 200,
body: {
text,
direction: 'Outbound',
id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
channel: { time: date.toISOString(), type: 'Private' },
type: 'Text',
originatingEntity: 'Bot',
metadata: {
correlationId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
},
},
}),
outboundDisconnectEventStructuredMessage: (date) => ({
type: 'message',
class: 'StructuredMessage',
code: 200,
body: {
direction: 'Outbound',
id: '0000000-0000-0000-0000-0000000000',
channel: {
time: date.toISOString(),
messageId: '0000000-0000-0000-0000-0000000000',
},
type: 'Event',
events: [
{
eventType: 'Presence',
presence: {
type: 'Disconnect',
},
},
],
},
}),
};