In the Salesforce application, as we know, chatbots can be linked to the same chat button, which can send chats to agents. So when chat is initiated from the website, chat will be triggered in the application, or the chatbot can respond to the chat. Depending on the customer business model, in some cases, the chatbot takes chat on priority, collects the basic details, and provides information based on the predefined questions and answers fed to the bot. And the chatbot transfers the chat to the agent only if needed or if the customer wishes to chat with the agent. Let us discuss two use cases around it.
In an online food ordering app, a chatbot can provide all the menu items and take orders from customers based on their choices and quantities. This can create an order in Salesforce and assign a rep to handle the order. In this case, the chatbot takes the chat first, which is appropriate.
In a hospital, chats are used as one of the channels to intake patients; always, patient advocates in the concerned department are available to chat with patients online and intake them by capturing relevant details from the patient. Only during non-business hours and weekends does the chatbot have to talk to patients, capture patient details, and create relevant follow-up activities for patient advocates when they are back to work the next business day. This way, hospitals do not lose their new incoming patients during off-hours.
These are two distinct use cases, so what’s the technical implementation strategy within the Salesforce application? Let’s now explore whether employing the pre-built Salesforce approach is effective, or if custom logic is required.
Answer: Actually need a blend of both!
When we link any chat button to a chatbot, always it comes to the bot as the first thing and the “Welcome” dialog on the chatbot’s Dialogs tab, as shown below.
At this juncture, we have the opportunity to craft a workflow that enables us to seamlessly verify business hours in real-time and route inquiries to patient advocates when they are online. To accomplish this, we can implement the following approach, with “targetdate” representing the current date and time.
isWithin(businessHoursId, targetDate)
- Define business hours in setup –> Business hours specific to the chatbot and agent shifts to switch the responsibility between the two.
- Create an apex class and invoke it from the chatbot action in the welcome dialogue as first thing to check if the current time is business hours or not.
- If business hours – configure the diaglog to redirect the control to the transfer agent action, which transfers the chat to agent available online
- If current time is non-business hours, call the next chatbot dialogue to be shown to the customer on chat.
- This way, chats can be transferred from chatbot to agent, as shown in the image below.
Invoking Check BusinessHours apex action
Transferring the chat to Agent calling TransfertoAgent Dialogue
Passing the queue details to transferagent action to identify the right people to transfer chat
“Now, here’s the intriguing twist in this narrative! After confirming business hours, we proceed to route the chats to online agents during their designated working hours.”
When all available agents have reached their maximum capacity, how should we manage or transition the chat to the chatbot?
In the ideal scenario, there isn’t a direct option to transfer the chat from an agent to a bot. However, if all agents decline or fail to respond to the chat due to their busy status, the chat will eventually be directed to the chatbot, thereby triggering the NoAgent dialog. This NoAgent dialog is readily available within the chatbot dialogs by default, as illustrated below. Developers must configure the flow to ensure it redirects the conversation back to the beginning from the NoAgent dialog.
Embracing the transformative potential of chat agents and bots in the Salesforce ecosystem is not merely a matter of keeping up; it’s a strategic choice to thrive in the era of continuous innovation.