BPMN-driven user interaction based on Camunda REST API

About a month ago we completed a project, where the main user facing features on a CMS based web portal were implemented with help of BPMN. In brief, certain actions at the portal trigger process instances at Camunda. Then processes are used to 1) redirect users to correct user interface routes (User Tasks) 2) pass data to required integrations between steps (Service Tasks).

I’ve written a generic high level summary, but because we ended up with a generic solution enough to re-use this in our future projects, we also released a “presentation” and a Docker demo with code dump to celebrate the annual community day of our CMS of choice.

Here I wanted to write down some technical notes on our BPMN use and why we needed to build additional API layer on top of the existing Camunda REST API:

  • We had to abstract the separation of running and completed processes away. Regarding the BPMN processes, the frontend fully relies on Camunda for the process state. The frontend needs to know if there has been a recently completed process and whether it completed successfully, was canceled manually or ended with an error. So, we built an abstraction where a single endpoint gives all state we need to know about a specific process, regardless its running state.

  • You never know if the next User Task is in the current process instance or somewhere deeper in the process tree (or in parallel processes loosely coupled with business key). We ended up with an abstraction where it is practically enough to know a businesskey and any active User Task connected to a process with that business key is returned.

  • We wanted to limit, which process variables the frontend can write, and it was safer to implement that in the middleware API than at frontent server routes. Technically we used Camunda Modeler “generated forms” feature to specify user tasks fields we allow user to write into. And we do also use submit-form -endpoint at Camunda to enforce validations supported by generated forms.

  • Finally, we implemented implicit wait for fast external tasks at our “Process API”. Whenever a user task is completed, we check if new (external) service tasks has been introduced into the process. If so, the api waits up to a few seconds for a signal from the external task worker that the task has been completed. This made the user experience fluent, because in most of the cases we are able to redirect user to the next user task route regardless of possible external service tasks between those steps (and when those take longer time, we redirect user to “We are processing your request”-like page that keeps polling the process until the next user task appears).


This is amazing! What an interesting project! Thank you so much for your contribution to Camunda. We would love to have this in the Camunda Community Hub if you would be interested in migrating it there. :slight_smile: The only thing the repository is missing to do so is a README.md file!

Again, thank you for your contribution and this wonderful project. I look forward to seeing it in action!

1 Like

The portal this was build for, has been in production about two months now, but since this forum is not its target group, I don’t share it here :slight_smile:

In brief, we had to implement pretty complex onboarding process for our international students, where student clicking “course registration”, is hand-held to complete:

  • email verification
  • electronic id verification
  • student account registration
  • login / change of forgotten password
  • course registration payment

And, finally, be back at the course page where everything. BPMN / Camunda made it possible to decouple process from the steps. Not only we were able to implement standalone user interface views (one view for one user task, mostly, each of the caring only about their own inputs and outputs), but we were to reuse those user task / subprocesses later.

I’m expecting to return to that project later this year, and possibly then I can polish the demo enough to be fit on the Community Hub :slight_smile:

Meanwhile, it would be interesting to hear and learn about other similar Camunda use cases.

1 Like