alexjolynintex

Launch a NWC External start workflow from a PHP page

Blog Post created by alexjolynintex Employee on Jun 16, 2017

That was basically the need of my customer who is heavily working with php and he wants to automate some stuff integrating some online services (including O365...and because now the Sharepoint Online connector is available, it opens a wide new range of capabilities!)

 

Of course, you can kick an external start workflow from anywhere, any language, any platform, there is no problem with that, but maybe the syntax may not be obvious to everyone on any language.

 

php... mmm it's been years I hadn't done any code in php . but it's like cycling, you never forget !

 

You don't need any specifi libraries, like zend or Curl. You can do that with native php.

After a few tries...I got there.

So, here is how you call an NWC external start workflow, from any PHP page.

 


<?php
$url = 'https://YOUR-EXTERNAL-START-URL-GOES-HERE';

 

$data = array(
"se_param1"=> "I LOVE THE PALESA'S HIP HOP FLOW",
"se_param2"=> "I said a hip hop the hippie the hippie to the hip hip hop, a you dont stop");

$dataOpt = array(
"callbackUrl"=> "https://wwww.XXXX.fr");

 

$masterData= array(
"startData"=> $data,
"options"=> $dataOpt);

 

$options = array('http' => array(
'method' => 'POST',
'header' => "Content-Type: application/json",
'content' => json_encode($masterData)
));

$context = stream_context_create($options);
$result = file_get_contents($url.$token, false, $context);
?>

 

AND MAGIC HAPPENS... Your NWC workflow will start...

Outcomes