When you start playing with workflows, they generally end up in the “Home” folder.
That's ok when you have 3 workflows, but once you start scaling, it can quickly become a nightmare.
The first thing to do is to follow our quick article Manage & organize workflows with folders
Developers
Folders architecture
When integrating our beautiful (😇) API, we can only strongly encourage you to create 3 folders:
- development (optional)
- staging
- production
You can also follow a naming convention, for example "[PROD] Workflow ABC" and "[DEV] Workflow ABC".
Combining both will help you build and maintain a clean workspace.
Workflows & code architecture
The second thing we advise you to do is to duplicate each workflow.
For example, if you have "staging" and "production", you should have one workflow "ABC" for staging and one for production.
Once you're happy with a workflow and you validated a few things operationally-wise, you can just duplicate it:
Add your naming convention [PROD] to the new workflow.
Hint: in our case, we used POC for "Proof Of Concept".
This implies that in your code, you should always add environment variables.
For example in a .env file:
CD_API_KEY: 51f646da-32f0-4ff3-9711-516cf92ead84
CD_PROJECT_UID: 9cfd10f3-5570-45cd-8e82-021c980b24e0
WORKFLOW_UID: a9c4391e-74be-46f2-9981-ed068d01d819
ACCOUNT_UID: 53371e80-c018-4e28-9433-3a6f9ab2bbe1
...
This way, you're sure your development environment won't temper with production workflows :)
Note: you can have different environment files or a big one, that's up to you; remember that you can also inject variables from your Gitlab/Github during CI/CD.
Launching workflows programmatically
If you're duplicating workflows across environments, you should probably also store the JSON configuration used to launch a workflow, which you can find in the API Playground.
It looks like this:
{
"steps": [
{
"accounts": [
"d5d7d1cc-d389-439f-8fe5-f633407b228a"
],
"parameters": {
"max_results": 10
},
"output_column": null,
"accounts_rotation_enabled": false,
"step_uid": "38a25f56-24a6-4674-bb53-f02dee4348ae"
}
],
"unstructure_meta": null,
"inputs": [
{
"sales_navigator_profile_search_url": "https://www.linkedin.com/sales/search/people?query=..."
}
],
"job_name": "JSON Example to Launch Workflow"
}
This way, you can just replace your environment variables or specific account IDs.
Hint: use the API Playground when developing