Feedback

  • Contents
 

ChatObject.requestedAttributeReturnHandler Callback

Definition

This callback allows a script to asynchronously get a chat attribute by first setting requestedAttributeReturnHandler and then calling chatObject.getAttribute. The chatObject will trigger the requestedAttributeReturnHandler handler after it has pulled down the necessary interaction attribute information from the server.

Compatibility

This functionality is only available with scripts for Interaction Connect. It is not available in Scripter .Net client.

Syntax

ChatObject.requestedAttributeReturnHandler(attributeName, attributeValue);

Input Parameters

Name

The name of a chat object attribute (e.g., ChatID, StationName, Language) or a custom chat attribute.

Return Values

Value

The value of the requested attribute is returned as a string.

Example

function main()
{
  var chatObject = scripter.createChatObject();
  chatObject.chatObjectInitializedHandler = uponChatObjectInitialization;
  chatObject.id = exampleId;
}
function uponChatObjectInitialization(chatObject)
{
  console.log('printing the chat direction ' + chatObject.direction);
  chatObject.requestedAttributeReturnHandler = uponAttributeReception;
  chatObject.getAttribute('IS_ATTR_EXAMPLE');
}
function uponAttributeReception(attributeName, attributeValue)
{
  console.log('The value of ' + attributeName + ' is ' + attributeValue);
}