I have created 2 bots, and after having some conversation with users I need to transfer the chat to the Agent. So for this, I am calling apex as an action from Einstein bot setup and doing this query there.
SELECT Id FROM UserServicePresence WHERE StatusEndDate = NULL AND IsCurrentState = TRUE AND IsAway = FALSE
It was fine until I had only one bot, but what/how should I add something to this query so it can't check if an agent is online for a specific bot.
So what's happening is, if an Agent is online for Bot1 and a request comes from Bot2 chat, the query returns true and because the session is different, the Bot2 gets stuck there and nothing happens.
I am using the same presence statuses for both chat configurations, is this the problem? Could anyone please help?