Initialising a process flow & sending data

Introduction

Having obtained a Patchworks token, it can be applied to an API request to initialise a process flow with your data passed in the request body.

You must control when your API requests are sent - the process flow trigger shape schedule cannot currently be used. With this in mind, please ensure that the default trigger shape in your process flow is not configured with any schedules.

The steps

Step 1 Create a POST request for the following endpoint:

https://start.wearepatchworks.com/api/v1/flows/<flowID>/start/<flowVERSION>

...replacing <flowID> and <flowVERSION> with details for your required process flow noted previously.

This endpoint is for the Patchworks production environment.

Step 2 In the request headers, pass in the token obtained previously - this should be prefixed with the word Bearer - for example:

Step 3 In the request body, pass in the required payload - for example:

{
  "payload": "[{\"id\":1000000001,\"first_name\":\"Jane\",\"last_name\":\"Smith\"},{\"id\":1000000002,\"first_name\":\"George\",\"last_name\":\"Jones\"}]"
}

Remember that the payload must be provided as a JSON object with a payload key containing a string of data. For more information please see Preparing your data.

Step 4 Send the request - if successful, a 200 'flow initialised' response is given, together with a flow run id:

You can check the status of this flow run via the run logs.

Last updated