Awaken Scripting User Guide |
|||||||
|
|||||||
Script.Plugins.genesyscloud.dial("01234567890", "MyQueue")
.then(function(response) {
// The dial function automatically displays a Toast to the agent for the successful dial
// Record the placed call's ID to a field:
[Call ID] = response.id;
})
.catch(function(response) {
// Display a Toast to the agent with the error message:
Script.Toast.Error("Dial Error", response.body ? response.body.message : response.error);
});
|
// Create the Genesys SDK master for easy reference later
var GenesysSDK = Script.Plugins.genesyscloud.genesysSdk();
// Create any desired SDK namespace objects
var ConversationsAPI = new GenesysSDK.ConversationsApi();
var OutboundAPI = new GenesysSDK.OutboundApi();
// Call the Genesys SDK
ConversationsAPI.getConversation("<Conversation GUID>")
.then(response => {
[Conversation Start] = response.startTime;
Script.Utils.GetCSObject([Process Conversation]).click();
})
.catch(function(response) {
// Display a Toast to the agent with the error message:
Script.Toast.Error("Check Conversation Error", response.body ? response.body.message : response.error);
});
|
Name
|
Description
|
Example Success Response
|
genesysSdk
|
This function is distinct from the other functions: it can be used to create an instance of Genesys' own JavaScript SDK for Genesys Cloud, from which any of the SDK functions that Genesys provide can be executed.
This function doesn't return a promise, and doesn't accept any parameters. Instead, it is used to allow creation of an instance of each of the Genesys API namespaces. When calling functions within these created API namespaces, they will always return a Promise.
Refer to Genesys' JavaScript SDK documentation for Genesys Cloud for the API namespaces and the child functions that can be called. Frequently, this document will need to be cross-referenced with Genesys' master API documentation for Genesys Cloud to see examples of required parameters and returned responses for these functions.
|
Refer to the Genesys Cloud REST documentation for the called function
|
checkConversationId
|
Returns an object containing the details of the specified conversation. Will only return details for a conversation that is both active, and that the currently logged-in user is a participant within.
Optional parameters:
|
{id: "<GUID>", startTime: "<ISO 8601 datetime string>", participants: [{...}], recordingState: "<State string>", divisions: [{...}], selfUri: "/api/v2/conversations/<GUID>"}
|
checkQueue
|
Returns an object containing the GUID for the specified queue. The search is case-insensitive.
Required parameters:
|
{queueId: "<GUID>", name: "<Name string>", _type: "queues"}
|
checkUser
|
Returns an object containing the details for the specified user. The search is by the username (typically their email), and is case-insensitive.
Required parameters:
|
{id: "<GUID>", name: "<Name string>", division: {...}, chat: {...}, email: "<Email string>", primaryContactInfo: [{...}], addresses: [...], state: "<State string>", username: "<Username string>", version: <Version integer>, acdAutoAnswer: <Boolean>, selfUri: "/api/v2/users/<GUID>"}
|
disconnect
|
Disconnects the specified interaction (as long as it is active, and the current agent is a participant), including hanging up the current call or leaving the current chat if applicable. When successful, it will then place the user in ACW within Genesys Cloud.
Optional parameters:
|
{}
|
disconnectCallback
|
Disconnects the specified callback (as long as it is active, and the current agent is a participant), including hanging up the current call or terminating the current preview if applicable. When successful, it will then place the user in ACW within Genesys Cloud.
Optional parameters:
|
{}
|
disconnectOnClose
|
Sets the awakenDisconnectOnClose key within the Script.Data layer to the specified value, controlling whether the current interaction will be disconnected within Genesys Cloud when the current script run is closed.
Required parameters:
|
""
|
getAgentAttributes
|
Returns an object containing the attributes for the most recent agent participant within the interaction.
Optional parameters:
|
{...}
|
getAttributes
|
Returns an object containing the attributes for the most recent participant of the specified purpose within the interaction.
Required parameters:
Optional parameters:
|
{...}
|
getCustomerAttributes
|
Returns an object containing the attributes for the most recent customer participant within the interaction.
Optional parameters:
|
{...}
|
getDetails
|
Returns an object containing basic details of the interaction, including arrays of the participants and division(s).
Optional parameters:
|
{id: "<GUID>", startTime: "<ISO 8601 datetime string>", address: "<Address string>", participants: [{...}], recordingState: "<State string>", divisions: [{...}], selfUri: "/api/v2/conversations/<GUID>"}
|
getToken
|
Returns a string of the currently active OAuth Token used to authenticate requests to the Genesys Cloud SDK. Accepts no parameters.
When using all standard library functions, this OAuth token will be supplied and managed automatically. It is only likely to be needed if executing commands directly against Genesys' RESTful API (e.g. if calling API functions directly in a Table control).
|
"<Token>"
|
setAgentAttributes
|
Merges the provided object into the existing attributes object for the most recent agent participant within the interaction. Returns an object that contains the submitted object.
Required parameters:
Optional parameters:
|
{attributes: {...}}
|
setAttributes
|
Merges the provided object into the existing attributes object for the most recent participant of the specified purpose within the interaction. Returns an object that contains the submitted object.
Required parameters:
Optional parameters:
|
{attributes: {...}}
|
setCustomerAttributes
|
Merges the provided object into the existing attributes object for the most recent customer participant within the interaction. Returns an object that contains the submitted object.
Required parameters:
Optional parameters:
|
{attributes: {...}}
|
wrapUp
|
Sets the specified wrap-up code and notes against the current step of the specified interaction, and optionally also disconnects the specified interaction.
Required parameters:
Optional parameters:
|
{}
|
Name
|
Description
|
Example Success Response
|
chatMessages
|
Returns an object containing the details of the 100 most recent messages for the specified interaction. The current user must be a participant within the specified interaction to be able to execute this function.
Please see the Genesys Cloud Chat article for more detail on the returned data structure and handling of chat interactions.
Optional parameters:
|
{lastCustomerMessage: "<Message string>", messages: [{...}], customerActive: <Boolean>}
|
chatReply
|
Submits the provided message to the chat for the specified interaction. Returns an object containing the details of the submitted message. The current user must be a participant within the specified interaction to be able to execute this function.
Required parameters:
Optional parameters:
|
{id: "<Message GUID>", conversation: {...}, sender: {...}, body: "<Message string>", bodyType: "standard", timestamp: "<ISO 8601 datetime string>", selfUri: "/api/v2/conversations/chats/<Conversation GUID>/messages/<Message GUID>"}
|
Name
|
Description
|
Example Success Response
|
setOutboundCampaignStage
|
Sets the specified stage for the current interaction for a Predictive campaign. Returns an empty string.
Stage is only available for Predictive campaigns, and is used to guide the predictive dialling algorithm's behaviour.
This function is automatically called whenever the page is transitioned using the page's name as the stage (e.g. [var_csPageName]), so this function is only required if you are using a Predictive campaign and wish to include more granular staging than page transfer.
Required parameters:
|
""
|
startPreviewCall
|
Initiates a call to the specified number within the Preview record's remaining available callback numbers. Returns an object containing details of the interaction.
Starting a preview call is only possible within a Preview campaign, and can only select from the remaining available callback numbers rather than being able to specify an arbitrary phone number to call. The available numbers are contained within the interaction's agent participant's callbacks array , in the callbackNumbers property.
Optional parameters:
|
{id: "<GUID>", startTime: "<ISO 8601 datetime string>", participants: [{...}], recordingState: "<State string>", divisions: [{...}], selfUri: "/api/v2/conversations/<GUID>"}
|
skipPreviewCall
|
Skips the current number within the Preview record, and disconnects the current callback interaction. Returns an empty object.
Skipping a preview call is only possible within a Preview campaign, and will cause the current call to be disconnected if already dialling or connected. The wrap-up code will be automatically set to the Genesys Cloud default code of ININ-OUTBOUND-PREVIEW-SKIPPED
Optional parameters:
|
{}
|
Name
|
Description
|
Example Success Response
|
dial
|
Creates a new call conversation, initiating a phone call to the specified number from the specified queue. Only works when not already within an existing conversation. Displays a toast to the agent with the result.
Required parameters:
|
{id: "<GUID>", selfUri: "/api/v2/conversations/calls/<GUID>"}
|
hold
|
Enables/disables placing the call on hold for the specified interaction. Returns an empty object.
Required parameters:
Optional parameters:
|
{}
|
mute
|
Enables/disables placing the call on mute for the specified interaction. Returns an empty object.
Required parameters:
Optional parameters:
|
{}
|
Name
|
Description
|
Example Success Response
|
blindTransfer
|
Initiates a blind transfer to the specified destination for the specified interaction, optionally closing & wrapping-up the script automatically. Returns an empty object.
The values available for transferType are defined in this API reference, and the voicemail modifier cannot be used.
Required parameters:
Optional parameters:
|
{}
|
blindTransferAddress
|
Initiates a blind transfer to the specified phone number for the specified interaction, optionally closing & wrapping-up the script automatically. Returns an empty object.
Required parameters:
Optional parameters:
|
{}
|
blindTransferUserId
|
Initiates a blind transfer to the specified user (identified by their GUID) for the specified interaction, optionally closing & wrapping-up the script automatically. Returns an empty object.
Required parameters:
Optional parameters:
|
{}
|
blindTransferUsername
|
Initiates a blind transfer to the specified user (identified by their username) for the specified interaction, optionally closing & wrapping-up the script automatically. Returns an empty object.
Required parameters:
Optional parameters:
|
{}
|
blindTransferQueueId
|
Initiates a blind transfer to the specified queue (identified by its GUID) for the specified interaction, optionally closing & wrapping-up the script automatically. Returns an empty object.
Required parameters:
Optional parameters:
|
{}
|
blindTransferQueueName
|
Initiates a blind transfer to the specified queue (identified by its name) for the specified interaction, optionally closing & wrapping-up the script automatically. Returns an empty object.
Required parameters:
Optional parameters:
|
{}
|
Name
|
Description
|
Example Success Response
|
startConsultToAddress
|
Initiates a consult transfer to the specified phone number for the specified interaction. Returns an object containing the destination participant's GUID.
Required parameters:
Optional parameters:
|
{destinationParticipantId: "<GUID>"}
|
startConsultToQueue
|
Initiates a consult transfer to the specified queue (identified by its name) for the specified interaction. Returns an object containing the destination participant's GUID.
Required parameters:
Optional parameters:
|
{destinationParticipantId: "<GUID>"}
|
startConsultToUser
|
Initiates a consult transfer to the specified user (identified by their username) for the specified interaction. Returns an object containing the destination participant's GUID.
Required parameters:
Optional parameters:
|
{destinationParticipantId: "<GUID>"}
|