{
    "name": "AgentBrains - Product Knowledge Enrichment",
    "flow": [
        {
            "id": 1,
            "module": "gateway:CustomWebHook",
            "version": 1,
            "parameters": {
                "hook": 3270807,
                "maxResults": 1
            },
            "mapper": {},
            "metadata": {
                "designer": {
                    "x": 0,
                    "y": 0
                },
                "restore": {
                    "parameters": {
                        "hook": {
                            "data": {
                                "editable": "true"
                            },
                            "label": "Product enrichment example flow"
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "hook",
                        "type": "hook:gateway-webhook",
                        "label": "Webhook",
                        "required": true
                    },
                    {
                        "name": "maxResults",
                        "type": "number",
                        "label": "Maximum number of results"
                    }
                ],
                "interface": [
                    {
                        "name": "sku",
                        "type": "text"
                    },
                    {
                        "name": "categoryId",
                        "type": "text"
                    },
                    {
                        "name": "search",
                        "type": "text"
                    }
                ]
            }
        },
        {
            "id": 2,
            "module": "builtin:BasicRouter",
            "version": 1,
            "mapper": null,
            "metadata": {
                "designer": {
                    "x": 300,
                    "y": 0
                }
            },
            "routes": [
                {
                    "flow": [
                        {
                            "id": 3,
                            "module": "app#agentbrains-pulssc:getManyEntities",
                            "version": 1,
                            "parameters": {
                                "__IMTCONN__": 7785706
                            },
                            "filter": {
                                "name": "Has a lookup key",
                                "conditions": [
                                    [
                                        {
                                            "a": "{{1.sku}}",
                                            "o": "exist"
                                        }
                                    ],
                                    [
                                        {
                                            "a": "{{1.categoryId}}",
                                            "o": "exist"
                                        }
                                    ],
                                    [
                                        {
                                            "a": "{{1.search}}",
                                            "o": "exist"
                                        }
                                    ]
                                ]
                            },
                            "mapper": {
                                "sku": "{{1.sku}}",
                                "search": "{{1.search}}"
                            },
                            "metadata": {
                                "designer": {
                                    "x": 600,
                                    "y": -150
                                },
                                "restore": {
                                    "expect": {
                                        "recursive": {
                                            "mode": "chose",
                                            "label": "Empty"
                                        },
                                        "categoryId": {
                                            "mode": "chose"
                                        }
                                    },
                                    "parameters": {
                                        "__IMTCONN__": {
                                            "data": {
                                                "scoped": "true",
                                                "connection": "app#agentbrains-pulssc"
                                            },
                                            "label": "ATN Stage"
                                        }
                                    }
                                },
                                "parameters": [
                                    {
                                        "name": "__IMTCONN__",
                                        "type": "account:app#agentbrains-pulssc",
                                        "label": "Connection",
                                        "required": true
                                    }
                                ],
                                "expect": [
                                    {
                                        "name": "categoryId",
                                        "type": "select",
                                        "label": "Category"
                                    },
                                    {
                                        "name": "search",
                                        "type": "text",
                                        "label": "Search"
                                    },
                                    {
                                        "name": "source",
                                        "type": "text",
                                        "label": "Source"
                                    },
                                    {
                                        "name": "sku",
                                        "type": "text",
                                        "label": "SKU"
                                    },
                                    {
                                        "name": "tags",
                                        "type": "text",
                                        "label": "Tags"
                                    },
                                    {
                                        "name": "fields",
                                        "type": "text",
                                        "label": "Fields"
                                    },
                                    {
                                        "name": "recursive",
                                        "type": "select",
                                        "label": "Recursive",
                                        "validate": {
                                            "enum": [
                                                "",
                                                "true",
                                                "false"
                                            ]
                                        }
                                    }
                                ]
                            }
                        },
                        {
                            "id": 4,
                            "module": "app#agentbrains-pulssc:getEntity",
                            "version": 1,
                            "parameters": {
                                "__IMTCONN__": 7785706
                            },
                            "mapper": {
                                "id": "{{3.items[].`_id`}}"
                            },
                            "metadata": {
                                "designer": {
                                    "x": 900,
                                    "y": -150
                                },
                                "restore": {
                                    "parameters": {
                                        "__IMTCONN__": {
                                            "data": {
                                                "scoped": "true",
                                                "connection": "app#agentbrains-pulssc"
                                            },
                                            "label": "ATN Stage"
                                        }
                                    }
                                },
                                "parameters": [
                                    {
                                        "name": "__IMTCONN__",
                                        "type": "account:app#agentbrains-pulssc",
                                        "label": "Connection",
                                        "required": true
                                    }
                                ],
                                "expect": [
                                    {
                                        "name": "id",
                                        "type": "text",
                                        "label": "Entity ID or Alias",
                                        "required": true
                                    }
                                ]
                            }
                        },
                        {
                            "id": 5,
                            "module": "app#agentbrains-pulssc:listCategoriesByTypeKey",
                            "version": 1,
                            "parameters": {
                                "__IMTCONN__": 7785706
                            },
                            "mapper": {
                                "categoryAlias": "{{4.category.`_id`}}"
                            },
                            "metadata": {
                                "designer": {
                                    "x": 1200,
                                    "y": -150
                                },
                                "restore": {
                                    "expect": {
                                        "categoryAlias": {
                                            "mode": "edit"
                                        }
                                    },
                                    "parameters": {
                                        "__IMTCONN__": {
                                            "data": {
                                                "scoped": "true",
                                                "connection": "app#agentbrains-pulssc"
                                            },
                                            "label": "ATN Stage"
                                        }
                                    }
                                },
                                "parameters": [
                                    {
                                        "name": "__IMTCONN__",
                                        "type": "account:app#agentbrains-pulssc",
                                        "label": "Connection",
                                        "required": true
                                    }
                                ],
                                "expect": [
                                    {
                                        "name": "categoryAlias",
                                        "type": "select",
                                        "label": "Category Type Name or ID",
                                        "required": true
                                    }
                                ]
                            }
                        },
                        {
                            "id": 6,
                            "module": "gateway:WebhookRespond",
                            "version": 1,
                            "parameters": {},
                            "mapper": {
                                "body": "{\n  \"entity\": {{`4`}},\n  \"matches\": {{`3`}},\n  \"categoryGroup\": {{5.items[].name}}\n}",
                                "status": "200",
                                "headers": [
                                    {
                                        "key": "Content-Type",
                                        "value": "application/json"
                                    }
                                ]
                            },
                            "metadata": {
                                "designer": {
                                    "x": 1500,
                                    "y": -150
                                },
                                "restore": {
                                    "expect": {
                                        "headers": {
                                            "mode": "chose",
                                            "items": [
                                                null
                                            ]
                                        }
                                    }
                                },
                                "expect": [
                                    {
                                        "name": "status",
                                        "type": "uinteger",
                                        "label": "Status",
                                        "required": true,
                                        "validate": {
                                            "min": 100
                                        }
                                    },
                                    {
                                        "name": "body",
                                        "type": "any",
                                        "label": "Body"
                                    },
                                    {
                                        "name": "headers",
                                        "spec": [
                                            {
                                                "name": "key",
                                                "type": "text",
                                                "label": "Key",
                                                "required": true,
                                                "validate": {
                                                    "max": 256
                                                }
                                            },
                                            {
                                                "name": "value",
                                                "type": "text",
                                                "label": "Value",
                                                "required": true,
                                                "validate": {
                                                    "max": 4096
                                                }
                                            }
                                        ],
                                        "type": "array",
                                        "label": "Custom headers",
                                        "validate": {
                                            "maxItems": 16
                                        }
                                    }
                                ],
                                "advanced": true
                            }
                        }
                    ]
                },
                {
                    "flow": [
                        {
                            "id": 7,
                            "module": "gateway:WebhookRespond",
                            "version": 1,
                            "parameters": {},
                            "filter": {
                                "name": "Missing lookup key",
                                "conditions": [
                                    [
                                        {
                                            "a": "{{1.sku}}",
                                            "o": "notexist"
                                        },
                                        {
                                            "a": "{{1.categoryId}}",
                                            "o": "notexist"
                                        },
                                        {
                                            "a": "{{1.search}}",
                                            "o": "notexist"
                                        }
                                    ]
                                ]
                            },
                            "mapper": {
                                "body": "{\n  \"error\": \"Provide at least one of: sku, categoryId, search\"\n}",
                                "status": "400",
                                "headers": [
                                    {
                                        "key": "Content-Type",
                                        "value": "application/json"
                                    }
                                ]
                            },
                            "metadata": {
                                "designer": {
                                    "x": 600,
                                    "y": 150
                                },
                                "restore": {
                                    "expect": {
                                        "headers": {
                                            "mode": "chose",
                                            "items": [
                                                null
                                            ]
                                        }
                                    }
                                },
                                "expect": [
                                    {
                                        "name": "status",
                                        "type": "uinteger",
                                        "label": "Status",
                                        "required": true,
                                        "validate": {
                                            "min": 100
                                        }
                                    },
                                    {
                                        "name": "body",
                                        "type": "any",
                                        "label": "Body"
                                    },
                                    {
                                        "name": "headers",
                                        "spec": [
                                            {
                                                "name": "key",
                                                "type": "text",
                                                "label": "Key",
                                                "required": true,
                                                "validate": {
                                                    "max": 256
                                                }
                                            },
                                            {
                                                "name": "value",
                                                "type": "text",
                                                "label": "Value",
                                                "required": true,
                                                "validate": {
                                                    "max": 4096
                                                }
                                            }
                                        ],
                                        "type": "array",
                                        "label": "Custom headers",
                                        "validate": {
                                            "maxItems": 16
                                        }
                                    }
                                ],
                                "advanced": true
                            }
                        }
                    ]
                }
            ]
        }
    ],
    "metadata": {
        "instant": true,
        "version": 1,
        "scenario": {
            "roundtrips": 1,
            "maxErrors": 3,
            "autoCommit": true,
            "autoCommitTriggerLast": true,
            "sequential": false,
            "slots": null,
            "confidential": false,
            "dataloss": false,
            "dlq": false,
            "freshVariables": false
        },
        "designer": {
            "orphans": []
        },
        "zone": "eu1.make.com",
        "notes": []
    }
}