How to properly handle scenario for chats?

There is a web-hook that listens to an event from WhatsApp Business API. The event is triggered immediately when a message arrives. After the message arrives, GPT responds to the client’s message. But the problem is that the client can write one sentence separately, for example, the sentence “I want to order such and such a project” and the client can write like this “I want to order” “such and such a project”. And for each message, the event handler is triggered and GPT responds to each message separately, thus breaking away from the context of communication with the client. How can this be improved? Maybe there are ready-made solutions for this in the scripts?