How to subscribe a role for the task notification programmatically?

Hello,

we have a task type with the “notify” action attached to the “onQueue” event. The purpose is that members of a certain role in MWS get a mail when a new instance of the task is created.

But the notifications only get sent if a subscription is set up for the role. Usually we set up such subscriptions via MWS GUI (task list management → subscriptions).

Is it possible to do this programmatically? I.e. I’d like to write some code which whould be executed on MWS. This code would get the task type ID and the role name as inputs and should set up a subscription for the specified role and task.

This way we want to automate the application setup.

Is this possible? And if yes, how?

Thank you.