Option in Camunda to run certain service tasks on button actions from External UI

Hi thr,
General question.

Imagine I have an external screen built in Angular/React which will be invoked when the process flow reaches a User Task in Camunda Engine.

There can be multiple button actions in the screen like Search, Save & Close, etc., Now for each those button actions, we can create some logic in java and expose it as REST and we can call those REST from UI.

Is there any way to implement those services in Camunda code itself like the service tasks and call it from the external UI and still my UI gets the response for that?

Or what would be the best way to implement this?