The Agent Assist for Voice feature provides Agent Assist Workspace for integration into contact center voice deployments.
To set up Agent Assist for Voice, you'll need a Main Flow that can transfer the call to a human agent, as well as an Agent Assist Workspace Flow. The Workspace Flow must be configured with a Webhook Endpoint to receive the transcription of the audio stream
Before transferring the call to a human agent, add a Code Node to send all relevant information to the contact center. This information will help the contact center to connect the call to the correct session and Agent Assist Workspace. The information will be sent to the contact center via SIP headers.
The Voice configuration consists of 3 parts:
The information below is currently specific to embedding the solution into Genesys Cloud CX. If you plan to embed it into other contact centers, additional information may be required.
Code Node
To connect to the correct session and Agent Assist Workspace in your contact center, submit all relevant information, including aawBaseUrl
, projectId
, organizationId
, configId
, URLToken
, sessionId
, and userId
. To do this, you will need to add a Code Node before your Transfer Node.
The following Code Node will generate a UUIValue, which will be forwarded as a SIP header when transferring the call:
/**
* This script will generate a "User-To-User" header payload for SIP transactions
* according to the convention which Genesys Cloud is following.
*
* You will be able to access it through input.UUIValue after running this code node.
*
* Make sure to update the values within the "CHANGEME" part when using this script in other places!
*/
/////////////////////////////////////////////////////////////////////////////////////////
// START OF "CHANGEME"
/////////////////////////////////////////////////////////////////////////////////////////
const aawBaseUrl = 'https://agent-assist-app.cognigy.ai';
const projectId = 'your projectId';
const organisationId = 'your organisationId';
const configId = 'your Agent Assist Configs Reference Id';
const URLToken = 'the URLToken of the Endpoint that is used with the Agent Assist Workspace';
/////////////////////////////////////////////////////////////////////////////////////////
// END OF "CHANGEME"
/////////////////////////////////////////////////////////////////////////////////////////
const encodeHex = (plain: string) => {
return plain.split("")
.map(c => c.charCodeAt(0).toString(16).padStart(2, "0"))
.join("");
}
const createUUIValue = (plain: string) => {
return `00${encodeHex(plain)};encoding=hex`;
}
const assistUserId = `assist-${input.userId}`;
const assistSessionId = `assist-${input.sessionId}`
const uui = `${aawBaseUrl}/?userId=${assistUserId}&sessionId=${assistSessionId}&URLToken=${URLToken}&organisationId=${organisationId}&projectId=${projectId}&configId=${configId}`;
input.assistUserId = assistUserId;
input.assistSessionId = assistSessionId;
input.UUIValue = createUUIValue(uui);
Transfer Node
When using the Cognigy Voice Gateway, you need to add a Transfer Node to hand over the call to a human agent.
To transfer the call, select the Dial option to remain in the session and transcribe the audio streams.
Transcription
In this Transfer Node, you need to enable the transcription of audio streams. You can choose between three options:
- Caller - the customer audio stream.
- Called - the human agent audio stream.
- Caller/Called - the customer and the human agent audio stream.
Transcription Webhook
The Transcription Webhook should be set to the Endpoint URL of the Webhook Endpoint that the Agent Assist Workspace flow uses to send the transcription.
Custom SIP Headers
To submit the UUIValue created in the Code Node before, add the following to the Custom SIP Headers section within the Transfer Node:
{
"User-to-User": "{{input.UUIValue}}"
}
Webhook Endpoint
A Webhook Endpoint needs to be created to receive the transcription and forward it to the Agent Assist Workspace Flow, triggering widget updates.
Transformers
In the Endpoint configuration, enable input and output transformers.
To ensure that the transcription is received in a format that is easy to work with, add the following transformer code to the Transformer section of the Endpoint. This code will render user and agent messages and forward them to the flow.
With this configuration, you can use the Agent Message
token to create if-conditions and configure actions based on user and agent input.
createWebhookTransformer({ /** * This transformer is executed when receiving a message * from the user, before executing the Flow. * * @param endpoint The configuration object for the used Endpoint. * @param request The Express request object with a JSON parsed body. * @param response The Express response object. * * @returns A valid userId, sessionId, as well as text and/or data, * which has been extracted from the request body. */ handleInput: async ({ endpoint, request, response }) => { /** * Extract the userId, sessionId and text * from the request. Example: * * const { userId, sessionId, text, data } = request.body; * * Note that the format of the request body will be different for * every Endpoint, and the example above needs to be adjusted * accordingly. */ const { userId, sessionId } = request.query; const source = (() => { switch (request.body.speech.channel_tag) { case 1: return "agent"; case 2: return "user"; default: return null; } })(); const text = request.body.speech.alternatives[0].transcript; const data = { source }; return { userId, sessionId, text, data }; }, /** * This transformer is executed on every output from the Flow. * For Webhook based transformers, the return value of this transformer * will be sent directly to the user. * * @param processedOutput The output from the Flow that has been processed into the final object * that will be sent to the user. It is structured according to the data structure used * on the specific Endpoint channel. * * @param output The raw output from the Flow. * @param endpoint The configuration object for the used Endpoint. * @param userId The unique ID of the user. * @param sessionId The unique ID for this session. Can be used together with the userId * to retrieve the sessionStorage object. * * @returns An object that will be sent to the user, unchanged. It therefore has to have the * correct format according to the documentation of the specific Endpoint channel. */ handleOutput: async ({ processedOutput, output, endpoint, userId, sessionId }) => { return null; return processedOutput; }, /** * This transformer is executed when the Flow execution has finished. * Since all outputs have been sent to the user, this transformer does not return anything. * * @param userId The unique ID of the user. * @param sessionId The unique ID for this session. Can be used together with the userId * to retrieve the sessionStorage object. * * @param endpoint The configuration object for the used Endpoint. * * @returns This transformer cannot return anything. */ handleExecutionFinished: async ({ sessionId, userId, endpoint }) => { }, /** * This transformer is executed when receiving an inject event. * The extracted text and data will be injected into the conversation * for the given user in the given session. * * @param request The Express request object with a JSON parsed body. * @param response The Express response object. * @param endpoint The configuration object for the used Endpoint. * * @returns A valid userId, sessionId, as well as text and/or data, * which has been extracted from the request body. The text and data * will be injected into this conversation. */ handleInject: async ({ request, response, endpoint }) => { /** * Extract the userId, sessionId and text * from the request. Example: * * const { userId, sessionId, text, data } = request.body; * * Note that the format of the request body will be different for * every Endpoint, and the example above needs to be adjusted * accordingly. */ const userId = ""; const sessionId = ""; const text = ""; const data = {} return { userId, sessionId, text, data }; }, /** * This transformer is executed when receiving a notify event. * The extracted text and data will be sent directly to the * given user in the given session as a notification. * * @param request The Express request object with a JSON parsed body. * @param response The Express response object. * @param endpoint The configuration object for the used Endpoint. * * @returns A valid userId, sessionId, as well as text and/or data, * which has been extracted from the request body. The text and data * will be sent directly to the user. */ handleNotify: async ({ request, response, endpoint }) => { /** * Extract the userId, sessionId and text * from the request. Example: * * const { userId, sessionId, text, data } = request.body; * * Note that the format of the request body will be different for * every Endpoint, and the example above needs to be adjusted * accordingly. */ const userId = ""; const sessionId = ""; const text = ""; const data = {} return { userId, sessionId, text, data }; } })
Comments
0 comments