@avaya/infinity-agent-sdk - v1.0.0
    Preparing search index...

    Interaction metadata

    This guide covers how to enrich an interaction with contextual data i.e. agent notes, customer contact details, the interaction subject, classification codes etc.

    Personas: Agent - the owning agent enriches the interaction with notes, customer details, subject, classifications, and custom fields.

    The Interaction can be enriched with different kinds of metadata:

    • Agent notes - textual notes captured by agents during the interaction.
    • Customer info and subject - customer contact details such as name, phone and email.
    • Interaction Subject - topic of the interaction.
    • Classification codes - information used to classify the interaction such as it's type and end result.
    • Custom fields - arbitrary key/value data persisted on the interaction record.

    Use Interaction.setNotes to persist textual notes, it is an async method which resolves when the update is completed. It is recommended to gate this action using the Interaction.canSetNotes. Use Interaction.notes to get the current value of notes.

    An event of type InteractionEventType.INTERACTION_NOTES_UPDATED will be emitted whenever the notes are updated, either by the current agent or by other agents (viewers of the interaction). Make sure to subscribe to this event to keep your UI updated.

    if (interaction.canSetNotes()) {
    await interaction.setNotes("Customer confirmed order #4821 - needs callback if delivery delayed.");
    }

    interaction.subscribe(InteractionEventType.INTERACTION_NOTES_UPDATED, (event) => {
    console.log("Notes updated:", event.payload.notes);
    });

    Update the customer info .i.e, name, phone number and email address on the Interaction.customer object using Customer.setName, Customer.setPhone, and Customer.setEmail respectively. Make sure to gate the aforementioned actions using Customer.canEdit. These methods are async and they resolve the update is complete.

    An event of type InteractionEventType.INTERACTION_CUSTOMER_INFO_UPDATED will be emitted whenever the customer info is updated, either by the current agent or by other agents (viewers of the interaction). Make sure to subscribe to this event to keep your UI updated.

    if (interaction.customer.canEdit()) {
    await interaction.customer.setName("Jane Smith");
    await interaction.customer.setPhone("+1-000-000-1234");
    await interaction.customer.setEmail("jane@example.com");
    }

    interaction.subscribe(InteractionEventType.INTERACTION_CUSTOMER_INFO_UPDATED, (event) => {
    const { name, phone, email } = event.payload.customer;
    });

    Update the subject of the interaction using Interaction.setSubject. Make sure to guard this action using Interaction.canSetSubject. Read current values via Interaction.customer and Interaction.subject.

    An event of type InteractionEventType.INTERACTION_SUBJECT_UPDATED will be emitted whenever the customer info is updated, either by the current agent or by other agents (viewers of the interaction). Make sure to subscribe to this event to keep your UI updated.

    if (interaction.canSetSubject()) {
    await interaction.setSubject("Billing dispute - invoice #INV-998");
    }

    interaction.subscribe(InteractionEventType.INTERACTION_SUBJECT_UPDATED, (event) => {
    console.log("Subject:", event.payload.subject);
    });

    An interaction classification codes can be used by the agents to define the type and end result of an interaction. These are configured at queue level.

    There are two kinds of classification codes:

    • Interaction type code - describes the reason the customer reached out or the purpose of the interaction
    • Interaction result code - describes the outcome of the interaction

    Each classification code has a name. The classification codes defined for the elite queues also have an eliteWorkCode.

    Read the available options from Interaction.queueDetails:

    const { classificationTypes, classificationResults } = interaction.queueDetails;
    // classificationTypes and classificationResults may be empty if no codes are defined

    Apply the agent's selections with Interaction.setClassificationType and Interaction.setClassificationResult, both gated by Interaction.canSetClassification.

    An event of type InteractionEventType.INTERACTION_CLASSIFICATION_UPDATED will be emitted whenever the classification is updated, either by the current agent or by other agents (viewers of the interaction). Make sure to subscribe to this event to keep your UI updated.

    if (interaction.canSetClassification()) {
    await interaction.setClassificationType({ name: "Technical Support", eliteWorkCode: "TS01" });
    await interaction.setClassificationResult({ name: "Resolved", eliteWorkCode: "RES" });
    }

    interaction.subscribe(InteractionEventType.INTERACTION_CLASSIFICATION_UPDATED, (event) => {
    console.log("Type:", event.payload.classificationType, "Result:", event.payload.classificationResult);
    });

    Currently set classification on the interaction can be viewed using Interaction.classificationType and Interaction.classificationResult.

    Elite agents: For Elite interactions, each classification entry carries an eliteWorkCode. Populate both name and eliteWorkCode when setting classifications on Elite interactions - eliteWorkCode values are configured by account administrators alongside the classification names at the queue level. See Elite Classification Codes.

    Custom fields are arbitrary key/value data persisted on the interaction record. Update them with Interaction.mergeCustomFields - it deep-merges the provided object into the existing Interaction.customFields, so keys you don't mention are preserved. Gate this action using Interaction.canMergeCustomFields.

    An event of type InteractionEventType.INTERACTION_CUSTOM_FIELDS_UPDATED is emitted whenever the custom fields change, whether by the current agent, another agent, or a server-side workflow. Its payload carries the full merged custom fields snapshot. Subscribe to this event to keep your UI updated.

    if (interaction.canMergeCustomFields()) {
    await interaction.mergeCustomFields({ crmCaseId: "CASE-1024", priority: "high" });
    }

    interaction.subscribe(InteractionEventType.INTERACTION_CUSTOM_FIELDS_UPDATED, (event) => {
    console.log("Custom fields:", event.payload.customFields);
    });

    For Elite interactions, each classification entry carries an eliteWorkCode that the SDK forwards to the Elite PBX for disposition tracking. Populate eliteWorkCode alongside name when submitting on Elite interactions:

    if (interaction.canSetClassification()) {
    await interaction.setClassificationType({ name: "Technical Support", eliteWorkCode: "TS01" });
    await interaction.setClassificationResult({ name: "Resolved", eliteWorkCode: "RES" });
    }

    eliteWorkCode values are configured by queue administrators. See Detecting Elite Context for how the deployment model is exposed at runtime.

    Failures surface as typed AvayaInfinityAgentSdkErrors with stable codes from AvayaInfinityAgentSdkErrorCodes. Errors that occur on the Interaction metadata path belong to the ASE_4xxx family - match error.code against AvayaInfinityAgentSdkErrorCodes to identify the specific failure. If no specific code applies, the SDK falls back to ASE_4000.