How to inject a chat message with the case number into a live agent chat?

pascalfrencken
Mega Sage

Our HR agents have been using Connect Support for years to facilitate chat support for our employees. In Connect Support, when a chat was promoted to a case, the case number was automatically sent to the employee in the chat.

 

We're now migrating to HR Agent Workspace and Agent Chat. Agent Chat does not automatically send the case number to the employee when an interaction is promoted to a case. Is there a way in which we can automatically inject a chat message into the conversation that shares the case number with the employee on behalf of the HR agent?

1 ACCEPTED SOLUTION

pascalfrencken
Mega Sage

I found a way to do this by creating a business rule on the interaction related record table (interaction_related_record). Upon insert of the related record, it sends a message to the open conversation with the HR case number:

(function executeRule(current, previous /*null when async*/) {
	var interaction = current.interaction;
	var conversation = sn_connect.Conversation.get(interaction.channel_metadata_document, interaction.channel_metadata_table);
	var message = 'Case ' + current.task.number + ' has been created';

    conversation.sendMessage({
        body: message,
        field: 'comments'
    });
})(current, previous);

View solution in original post

1 REPLY 1

pascalfrencken
Mega Sage

I found a way to do this by creating a business rule on the interaction related record table (interaction_related_record). Upon insert of the related record, it sends a message to the open conversation with the HR case number:

(function executeRule(current, previous /*null when async*/) {
	var interaction = current.interaction;
	var conversation = sn_connect.Conversation.get(interaction.channel_metadata_document, interaction.channel_metadata_table);
	var message = 'Case ' + current.task.number + ' has been created';

    conversation.sendMessage({
        body: message,
        field: 'comments'
    });
})(current, previous);