since v11.32
The ChatBacklogHandler can be used to access chats within the backlog in the novomind iAGENT routing process. This handler is only available in the novomind iAGENT routing process.
An example usage of a ChatBacklogHandler would look like this:
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.inject.Inject;
import com.novomind.ecom.api.iagent.backlog.BacklogChatInfo;
import com.novomind.ecom.api.iagent.backlog.ChatBacklogHandler;
import com.novomind.ecom.api.iagent.model.Category;
import com.novomind.ecom.api.iagent.model.Chat;
import com.novomind.ecom.api.iagent.model.User;
@Inject
private ChatBacklogHandler chatBacklogHandler;
public int getChatsQueuedCount(Category category) {
return (int) chatBacklogHandler.stream()
.filter(chat -> category == null || category.equals(chat.getCategory()))
.filter(chatBacklogHandler.isRoutable())
.count();
}
public Set<Chat> getActiveChats(User agent) {
return chatBacklogHandler.stream()
.map(chat -> chatBacklogHandler.getBacklogChatInfo(chat))
.filter(Optional::isPresent)
.map(Optional::get)
.filter(backlogChatInfo -> backlogChatInfo.getActiveAgent().isPresent())
.filter(backlogChatInfo -> backlogChatInfo.getActiveAgent().get().getId().equals(agent.getId()))
.map(BacklogChatInfo::getChat)
.collect(Collectors.toSet());
}
since v12.29
The interface BacklogChatInfo offers the method getChatState to access the current ChatState of the chat:
The chat has been started.
The chat is queued and waiting to be routed to an agent or bot.
The chat has been routed to an agent or bot.
The chat has been resubmitted by an agent and will be routed to the agent or another agent after the specified due date.
The chat has been quit.
The chat has been closed. This is a final state.