Workflow
Definition
A workflow is a piece of code that can be executed:
- Periodically, like a cron-job. We call them Pull workflows.
- When a request is received on an endpoint. We call them Catch workflows.
Workflows are usually developed and tested locally on the developer's computer, then uploaded to HrFlow developer platform.
Workflows are very similar to serverless functions.
For more details regarding how to code a workflow, see here
How to create and manage a workflow
Prerequisites
Step 1: Go to the Connectors Marketplace
Then choose your workflow type by clicking on it:
- Pull workflows run periodically (you define a time interval between two executions)
- Use cases: synchronisation cron jobs, etc...
- Catch workflows are triggered by requests made at the workflow's endpoint
- Use cases: aggregate HrFlow requests (e.g. Parsing and Tagging APIs), etc...
Then, click on "Create workflow":
Step 2: Configure your workflow
You need to provide a name and a description for the worflow.
Additionally, you can add managers (resource owner) and make the workflow private.
Step 3: Retrieve workflow endpoint or set periodicity
- Catch workflows:
Data sent to the workflow URL will be processed by the workflow
- Pull workflows:
Set the interval between two executions
Your workflows are listed under Connections > My Workflows
Step 4: Write code for your workflow
For optimal experience, developing a workflow requires four steps:
- Develop the workflow locally using Python and your favourite IDE
- Test the workflow locally
- Upload the code to HrFlow platform
- Test the deployed workflow
workflow
function signature
workflow
function signature- Catch workflows:
def workflow(_request: Dict, settings: Dict) -> Union[None, Dict]
- Pull workflows:
def workflow(settings: Dict) -> Union[None, Dict]
Environment variables and dependencies
- Environment properties allow you to pass environment variables to your workflow. They will be available in the
settings
dictionary passed as argument. For instance, usesettings["email"]
to access the following env. variable:
- Make sure your Python and dependencies versions match the ones required by HrFlow (under the function tab):
You will still have to import Python modules in your code.
Sample code
Here is a sample code to get you started with Catch workflows
import json
def workflow(_request: dict, settings: dict):
# < custom logic goes here >
return dict(
status_code: 201,
headers={"Content-Type": "application/json"},
body=json.dumps({
"message": "Hello World"
}))
Advanced Topics
1. Debugging a Workflow
When a workflow is triggered, you can see it in "Debugger" section.
2. Changing the settings of a Workflow
Each workflow has custom parameters. The 'Settings' section allows you to edit them.
3. Archiving a Workflow
You can click the button Β«Archive this workflowΒ» to delete the workflow.
Archiving a workflow
This operation is irreversible
Updated 2 days ago