@cognigy/rest-api-client
Version:
Cognigy REST-Client
354 lines • 9.96 kB
JavaScript
/**
* IMPORTANT: This file exists in two places:
* - cognigy/services/service-handover/src/old_shared/interfaces/messageAPI/handover.ts
* - cognigy/shared/interfaces/messageAPI/handover.ts
*
* Please keep both files in sync.
*/
import { foreignSessionDataSchema, handoverSettingsSchema, queueUpdateOptionsSchema } from "../handover";
export const createHandoverRequestDataSchema = {
title: "createHandoverRequestDataSchema",
"type": "object",
"required": [
"projectId",
"organisation",
"userId",
"sessionId",
"flowReferenceId",
"URLToken"
],
"additionalProperties": true,
"properties": {
"projectId": {
"type": "string",
"format": "mongo-id",
},
"handoverProvider": {
"type": "string",
},
"handoverProviderConfig": {
"type": "object",
},
"organisation": {
"type": "string",
"format": "mongo-id",
},
"userId": {
"type": "string"
},
"sessionId": {
"type": "string"
},
"flowReferenceId": {
"type": "string",
"format": "uuid"
},
"flowName": {
"type": ["string", "null"]
},
"profile": {
"type": "object"
},
// We cannot set format: endpoint-channel, since the channel can be
// overridden by the customer (e.g. for their website)
"channel": {
"type": "string",
},
"requestedAt": {
"type": "number"
},
"requestInputId": {
"type": "string"
},
"previousInputId": {
"type": ["string", "null"]
},
"previousInputMessageAmount": {
"type": "number"
},
"handoverRequestId": {
"type": "string",
},
"URLToken": {
"type": "string"
},
"foreignSessionData": {
"type": "object"
},
"settings": {
"type": "object"
},
"foreignSessionId": {
"type": "string"
},
"chatwootInboxId": {
"type": "string",
},
"liveAgentInboxId": {
"type": "string"
},
"liveAgentAllowAgentInject": {
"type": "boolean"
},
"sendTranscriptAsFirstMessage": {
"type": "boolean"
},
"buttonId": {
"type": "string"
},
salesforcePrechatDetails: {
type: ["object", "array", "number", "string"],
},
salesforcePrechatEntities: {
type: ["object", "array", "number", "string"],
},
salesforceMIAWRoutingAttributes: {
// @ts-ignore - not working properly with the type
type: ["object", "array", "number", "string"],
},
salesforceMIAWCustomerIdentityToken: {
type: "string"
},
enableHandoverDisconnectMessageLiveAgent: {
type: "boolean"
},
enableHandoverConnectMessageLiveAgent: {
type: "boolean"
},
enableHandoverDisconnectMessageGenesys: {
type: "boolean"
},
enableHandoverConnectMessageGenesys: {
type: "boolean"
},
enableHandoverDisconnectMessageRingCentralEngage: {
type: "boolean"
},
enableHandoverConnectMessageRingCentralEngage: {
type: "boolean"
},
"notifySessionId": {
"type": "string",
},
"disableSensitiveLogging": {
"type": "boolean"
},
"traceId": {
"type": "string"
}
}
};
const getHandoverRequestFlowQuerySchema = {
title: "getHandoverRequestFlowQuerySchema",
additionalProperties: false,
type: "object",
required: ["userId", "organisation"],
properties: {
userId: { type: "string" },
organisation: { type: "string", format: "mongo-id" },
flowId: { type: "string", format: "mongo-id" }
}
};
const getHandoverRequestSessionQuerySchema = {
title: "getHandoverRequestSessionQuerySchema",
additionalProperties: false,
type: "object",
required: ["sessionId"],
properties: {
sessionId: { type: "string" },
}
};
const getHandoverRequestForeignSessionQuerySchema = {
title: "getHandoverRequestForeignSessionQuerySchema",
additionalProperties: false,
type: "object",
required: ["foreignSessionId"],
properties: {
foreignSessionId: { type: "string" },
}
};
export const getHandoverRequestDataSchema = {
title: "getHandoverRequestDataSchema",
type: "object",
additionalProperties: false,
properties: {
disableSensitiveLogging: { type: "boolean" },
traceId: { type: "string" },
query: {
// @ts-ignore
oneOf: [getHandoverRequestFlowQuerySchema, getHandoverRequestSessionQuerySchema, getHandoverRequestForeignSessionQuerySchema]
}
}
};
export const sendMessageToProviderSchema = {
title: "sendMessageToProviderSchema",
"type": "object",
"required": [
"organisation",
"sessionId",
"messages",
"URLToken"
],
"additionalProperties": false,
"properties": {
"organisation": {
"type": "string",
"format": "mongo-id",
},
"userId": {
"type": "string"
},
"sessionId": {
"type": "string"
},
"projectId": {
"type": "string"
},
"messages": {
"type": "array",
"items": {
"required": [
"source",
"userId",
"message"
],
"additionalProperties": false,
"properties": {
"source": {
"type": "string",
"enum": ["bot", "user"]
},
"userId": {
"type": "string"
},
"message": {
"type": ["null", "string"],
},
"data": {
"type": ["object", "null"],
},
"settings": {
"type": ["object", "null"]
},
"timestamp": {
"type": ["object", "null"]
},
"attachments": {
"type": ["array", "null"]
}
}
}
},
"URLToken": {
"type": "string"
},
"disableSensitiveLogging": {
"type": "boolean"
},
"traceId": {
"type": "string"
},
"message_type": {
"type": ["null", "string"]
}
}
};
export const activateHandoverConversationSchema = {
title: "activateHandoverConversationSchema",
"type": "object",
"required": [
"userId",
"sessionId",
],
"additionalProperties": false,
"properties": {
"userId": {
"type": "string"
},
"sessionId": {
"type": "string"
},
"disableSensitiveLogging": {
"type": "boolean"
},
"traceId": {
"type": "string"
}
}
};
export const pollEventSchema = {
title: "pollEventSchema",
type: "object",
additionalProperties: false,
required: ["handoverSettings", "traceId", "disableSensitiveLogging"],
properties: {
handoverSettings: handoverSettingsSchema,
foreignSessionData: foreignSessionDataSchema,
foreignSessionId: { type: "string" },
organisation: { type: "string" },
sessionId: { type: "string" },
traceId: { type: "string" },
disableSensitiveLogging: { type: "boolean" },
pollingTimeoutAt: { type: "number" },
sequence: { type: "number" },
lastEventId: { type: "string" },
projectId: { type: "string" },
URLToken: { type: "string" },
userId: { type: "string" },
channel: { type: "string" },
retryCount: { type: "number" }
},
};
export const handleHandoverRpcEventSchema = {
title: "handleHandoverRpcEventSchema",
type: "object",
additionalProperties: false,
required: [
"providerId",
"eventType",
"message",
"traceId",
"disableSensitiveLogging"
],
properties: {
providerId: { type: "string" },
eventType: { type: "string", enum: ["agentReply", "agentTypingOn", "agentTypingOff", "conversationClosed", "conversationFailed", "unknown"] },
foreignSessionData: foreignSessionDataSchema,
foreignSessionId: { type: "string" },
message: { type: ["string", "null"] },
data: { type: "object" },
traceId: { type: "string" },
disableSensitiveLogging: { type: "boolean" }
},
};
export const getQueueUpdateEventsSchema = {
title: "getQueueUpdateEventsSchema",
type: "object",
additionalProperties: true,
required: [
"handoverSettings",
"foreignSessionData",
"traceId",
"disableSensitiveLogging"
],
properties: {
organisationId: { type: "string" },
projectId: { type: "string" },
handoverSettings: handoverSettingsSchema,
foreignSessionData: foreignSessionDataSchema,
queueUpdateOptions: queueUpdateOptionsSchema,
sessionId: { type: "string" },
traceId: { type: "string" },
disableSensitiveLogging: { type: "boolean" }
},
};
;
;
;
;
;
[];
;
;
;
//# sourceMappingURL=handover.js.map