Skip to main content
Flow Integration

How to configure the Flow integration.

Updated over a week ago

Epsilon3 can integrate with Flow via our Realtime Client for pulling data from Flow into Epsilon3 procedures.

  • Step 1 - If you already have a Realtime Client that you use for other integrations, skip this Step and continue on Step 2.

    • Download the Epsilon3 realtime client from here and follow the setup instructions.

  • Step 2 - Add the following code near the top of your /src/external_data.py file

import requests
import os
import json

FLOW_API_KEY = os.getenv('FLOW_API_KEY')
FLOW_ORGANIZATION_ID = os.getenv('FLOW_ORGANIZATION_ID')
FLOW_PROJECT_REQUIREMENTS_API_URL = os.getenv('FLOW_API_URL', 'https://api.flowengineering.com/rest/v1/org/{orgSlug}/project/{projectSlug}/requirements')

def extract_text(requirement_statement):
results = ''
for child in requirement_statement:
if child.get('text'):
results += child.get('text') + '\n'
if child.get('children'):
results += extract_text(child.get('children'))
return results

then add the following code to the if statement in the search_items_response method

elif (request_type.startswith('flow_requirements.')):
project = request_type.split('.')[1]
url = FLOW_PROJECT_REQUIREMENTS_API_URL.format(orgSlug=FLOW_ORGANIZATION_ID, projectSlug=project)
response = requests.get(url, headers={"Authorization": FLOW_API_KEY})
requirements = response.json()
for requirement in requirements:
items.append({
'id': requirement['id'],
'name': requirement['name'],
'label': requirement['name'],
'valid' : True,
'details': [{
'name': 'Requirement Name',
'value': requirement['name']
},
{
'name': 'Requirement ID',
'value': requirement['id']
},
{
'name': 'Requirement Statement',
'value': extract_text(json.loads(requirement['statement_raw'] or '{}'))
}]
})

and finally, run the following command to install the new dependency

pip install requests
  • Step 3 - Set the local environment variables FLOW_API_KEY and FLOW_ORGANIZATION_ID

    • The API key can be generated under the Settings Page -> Account -> API

    • The organization ID can be found under the Settings Page -> Organization -> General. It is the portion after the last forward slash in the Organization URL

export FLOW_API_KEY=your_api_key
export FLOW_ORGANIZATION_ID=your_flow_organization
  • Step 4 - Create an external data type with a type starting with flow_requirements. followed by the name of the project that you want to validate requirements for, e.g. {"type": "flow_requirements.default-project", "label": "Flow Default Project"}

  • Step 5 - Add a field input block of type external data to your procedure and select the external data type created in Step 4

    • During runtime you will be able to select a requirement from the list of requirements in the selected project and see the requirement name, ID, and plaintext statement (no images or syntax highlighting)

Did this answer your question?