Casting calls with the same parent class
I'm not sure if there is enough context for me to fully understand the restrictions you are wporking with but I will try anyway... 25 years ago an elder university student half-jokingly taught me that the solution to any problem is always to &quot;add another layer of indirection.&quot; In this case, split handleUpdate so that each message type has their own handler object and place the type specific request handling into those classes. Furthermore, separate each type specific response handler into their own class (to maintain single responsibility principle) and inject that dependency to each update handler.
I.e. move type specific handling to the module where the type is still known. The function of the instanceof-block you want to get rid of will now effectively be moved to the if-block in the handleUpdate method and you don't need to repeat it again in the response handling code.