What Happens if More than One Message is Sent to the Bot?
- Getting Started
- Bot Building
- Smart Agent Chat
- Conversation Design
-
Developer Guides
Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
- Deployment
- External Agent Tool Setup
- Analytics & Reporting
- Notifications
- Commerce Plus
- Troubleshooting Guides
- Release Notes
Table of Contents
When a user is having a conversation with the bot, the usual flow is where the user sends a message to the bot, and the bot responds to that message with a pre-fed response. Well, this is one basic scenario. But, at times it might happen that a user might send two different messages at the same time, with two different intents. In this case, how will the bot respond? Which message will be considered first and which one later? Let us understand this through this document.
It is quite difficult to predict what would happen because of the multi-threaded nature in which the pipeline works on Haptik.
So, every user message that is sent, is added to a queue where multiple (software) workers pick it up for processing. Here, as we discussed in the above paragraph it might happen that 2 user messages that arrived were picked by two workers at the same time and processed parallelly.
Now, the difference in how the pipeline responds is completely dependent on when a user's message is picked by our pipeline's worker for processing.
Let's look at a few examples to understand how this might work.
SCENARIO 1 (Message-1 is processed by the pipeline before Message-2 was picked):
In this scenario, when Message-1 and Message-2 are sent by the user, the bot calculated Message-1's response first and sent it to the user, even before Message-2's response was calculated.
So ideally, Message-1's response will be sent first and Message-2's response will be sent later.
SCENARIO 2 (Message-1 and Message-2 are processed at the same time)
In this scenario when the user sends Message-1 and Message-2, the response for the user's Message-1 gets processed first, but then before it is sent out, Message-2 gets processed.
So, in such cases, the Message-1's response will be discarded and Message-2's response will be sent back
SCENARIO 3 (Message-1's message was processed a bit later than Message-2)
In this scenario, when Message-1 and Message-2 are sent by the user, the response for Message-2 gets processed before Message-1 (a rare scenario due to multithreading).
In such cases, Message-1's response will be discarded and only Message-2's response will be sent back to the user.