FlowMate API Implementation

This guide outlines best practices for integrating FlowMate into your application using the FlowMate API. The integration process consists of the following key steps:

Understanding the FlowMate process

The FlowMate integration follows a structured process, from creating a flow to executing it with real data. Below is a high-level overview of how it works:

  1. User creates a flow: A user creates a new flow in FlowMate using the Integration Center or Integration Portal. Each flow is assigned a unique ID, such as 1234.

  2. Retrieving flows for active users: As a FlowMate Partner, fetch all active flows via API to get the flow IDs.

  3. Match flows to users: Link each active flow to the corresponding user in your system.

  4. Set up the webhook: Configure a webhook to send data to the user’s flow.

  5. Trigger the flow: When data is sent to the webhook URL, the flow executes with the provided payload.

Working with the FlowMate API

To effectively integrate with the FlowMate API, it's important to understand the key steps involved. The process follows a structured approach to retrieving user and flow data, processing the relevant payload, and triggering flows for execution.

The technical process at a high level involves the following steps:

  1. Retrieve flows for active users

  2. Extract Payload for actions

  3. Trigger a flow - Send processed data to FlowMate

Each user in FlowMate has 2 ids. One is the user id that your system passes to us and the other is a FlowMate internal user id. The FlowMate API works with the FlowMate internal user ID.

Retrieve active users

GET /users

Every user in FlowMate has 2 different ids. One is the user id that your system passes to us and the other is a FlowMate internal user id. The FlowMate API works with the FlowMate internal user ID.

Start by retrieving active users. You need the user information to match them with the corresponding flows and ensure that the right data is processed.

To retrieve all active users, perform a GET request to the following endpoint:

 https://api.platform.openintegrationhub.com/users/

Query Params

Name
Type
Description

username

string

Filter by username. The user name is the ID that you give us, respectively your system’s identifier

meta

boolean

Set to true to receive response in data/meta format

To retrieve the FlowMate internal user id (_id) of a specific user, use the user parameter and filter for the username:

GET https://api.platform.openintegrationhub.com/users?username={user-id}

The response contains key user details that help identify and manage active users. The most relevant fields include:

  • _id: The internal FlowMate user ID, which uniquely identifies the user within FlowMate.

  • username: The user ID that corresponds to your system’s identifier.

  • status: Indicates whether the user is currently active.

Response

{
    "id": "string",
    "username": "string",
    "status": "ACTIVE",
    "confirmed": true,
    "canLogin": false,
    "tenant": "string",
    "roles": [],
    "permissions": [
        "flows.read",
        "tenant.flows.update",
        "flows.update",
        "flows.delete",
        "flows.control",
        "icenter.read",
        "icenter.write",
        "secrets.create",
        "secrets.read",
        "secrets.delete",
        "templates.read",
        "components.read",
        "components.write"
    ],
    "createdAt": "2023-11-09T20:46:58.652Z",
    "updatedAt": "2023-11-09T20:46:58.652Z",
    "__v": 0,
    "safeguard": {
        "failedLoginAttempts": 0,
        "lastLogin": "2024-12-30T13:30:27.529Z"
    }
}

Retrieve all active flows for the user

GET /flows

Once you have identified the active users, the next step is to retrieve their associated flows. In a single request, you can get all active flows for a user, including the necessary payload data for further processing.

To retrieve all active flows associated with a user, perform a GET request:

GET https://api.platform.openintegrationhub.com/flows

Query Params:

Name
Type
Description

page[size]

integer

Amount of flows per page returned. Default is 10.

page[number]

integer

Number of the page to be returned. Default is 1.

filter[status]

string

Filter results by flow status. Accepts either string ('active' and 'inactive') or integer (1 or 0)

filter[user]

string

Filter by user. Works for admin or users with same tenant.

To retrieve all active flows associated with a user apply the following filters:

  • filter[status]=active

  • filter[user]=_id

Example Request:

GET https://api.platform.openintegrationhub.com/flows?filter[status]=active&filter[user]={_id}

The response provides a list of flows, each linked to a specific user and tenant:

  • Flow ID: The id field (e.g., 6762e154616e91cb8d8b1aaf) at the top level of each flow object, which uniquely identifies the flow.

Response:

{
    "data": [
    .....
        {
            "id": "6762e154616e91cb8d8b1aaf",
            "owners": [
                {
                    "id": "636d0762bd257a7eb2373d6c",
                    "type": "user"
                },
                {
                    "id": "636d0762bd257a7eb2373d6a",
                    "type": "tenant"
                }
            ]
        }
    ]
}

Use the payload to provide the necessary data

In the response from the previous API call to https://api.platform.openintegrationhub.com/flows, you will also find the payload. It contains the data structure required for processing the flow correctly.

To ensure that the necessary data is available, the payload specifies which input parameters need to be provided and what output can be expected. This structure must be adhered to so that the flow operates as intended.

The payload could look like this:

inputParameters: { "firstName": "string", "lastName": "string"},
outputParameters: { "ID": "number", "active": "boolean"}

Send information based on payload to FlowMate

POST /flows

In the previous step, you retrieved the payload for the flow. Now, you need to use this data and send it back to FlowMate to trigger the next processing step.

To send data back to FlowMate, use the following POST request:

POST https://api.platform.openintegrationhub.com/webhooks/{flowID}

Path Parameter:

Name
Type
Description

{flowID}

string (required)

The unique identifier of the flow associated with the webhook

Request Body:

The request should include the payload structured according to the flow’s expected parameters.

{
  "data": {
    "key1": "value1",
    "key2": "value2"
  }
}

This step ensures that the processed data is correctly passed to FlowMate for further execution within the flow.

Last updated