Using webhooks to start a process in Process Services

cancel
Showing results for 
Search instead for 
Did you mean: 
zayed
Member II

Using webhooks to start a process in Process Services

I was wondering if there is a way of using a webhook to start a process in Process Services from an external app/system? I have a very simple process that starts, sends an email to alert me that it has started, and then ends. What I was hoping to achieve was the ability to start this process from an external app (using a webhook), the process runs in Process Services, and then communicates a message back to the external app (again using a webhook) that simply reads "process complete" for example. I have asked the question (in the wrong Gitter room!) to which I was advised on using the "Recieve task" trigger in my process and the "Rest call task" trigger to simulate the incoming and outgoing web hooks. I am a bit confused on how I can achieve this using these triggers? (Apologies, I am at a beginner level with Process Services!). 

Any help would be very much appreciated, thanks in advance!

2 Replies
Highlighted
benro
Member II

Re: Using webhooks to start a process in Process Services

Hi Zayed,

It is possible to invoke an APS process via REST API from an external webhook.  I have an example of an APS process being invoked from a Jira webhook.   Sample code here :GitHub - benro/DEVCON2018: Alfresco Devcon 2018 - APS+Serverless+Webhooks Sample using Jira and AWS ... 

And a deep dive here: Alfresco DevCon 2018: APS + Serverless + Webhooks - YouTube 

Hope this helps.

Ben

mdtabrezmca
Established Member II

Re: Using webhooks to start a process in Process Services

I think you can achieve this by using Alfresco proces services public rest apis.

for your solution what you can call

http://{yourdomain)/activiti-app/api/enterprise/process-instances

this api will start the process instance. you may need to pass the variables required by the start form if configured. This APIs  Reponse will give you Process instance id.using this process instance id you can invoke next task of the process.

http://{yourdomain)/activiti-app/api/enterprise/tasks/query

Where this task can be again REST task which can trigger your custom API. I hope i this way it will help you.