Create New Task on custom Button Click

Hi
I am using the BPMN in the java script and i have a custom left bar menu
so i want to create user task or email task on that button click
Please help.

Regards
Junaid

Have you checked out this example?

Yes i checked this example but its in node js but i am using the native JS
Not sure how to work with this.

You can use our pre-built distributions for that: https://github.com/bpmn-io/bpmn-js-examples/tree/master/starter