{
  "name": "Add a verified work email to new HubSpot contacts that have none with PeopleSearch.im",
  "flow": [
    {
      "id": 1,
      "module": "hubspotcrm:WatchCRMObjects",
      "version": 1,
      "parameters": {
        "limit": 10,
        "filterBy": "",
        "objectType": "contacts",
        "watchPattern": "created",
        "outputProperties": [
          "firstname",
          "lastname",
          "company",
          "website",
          "email"
        ]
      },
      "mapper": {},
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0
        },
        "restore": {
          "filterBy": {},
          "objectType": {
            "mode": "chose"
          },
          "watchPattern": {},
          "outputProperties": {},
          "parameters": {
            "__IMTCONN__": {}
          }
        }
      }
    },
    {
      "id": 2,
      "module": "app#peoplesearch-im:findWorkEmailByName",
      "version": 1,
      "filter": {
        "name": "Has a name and company, but no email yet",
        "conditions": [
          [
            {
              "a": "{{1.properties.email}}",
              "o": "notexist"
            },
            {
              "a": "{{1.properties.lastname}}",
              "o": "exist"
            },
            {
              "a": "{{ifempty(1.properties.website; 1.properties.company)}}",
              "o": "exist"
            }
          ]
        ]
      },
      "parameters": {},
      "mapper": {
        "firstName": "{{1.properties.firstname}}",
        "lastName": "{{1.properties.lastname}}",
        "company": "{{ifempty(1.properties.website; 1.properties.company)}}"
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0
        },
        "restore": {
          "parameters": {
            "__IMTCONN__": {}
          }
        }
      }
    },
    {
      "id": 3,
      "module": "hubspotcrm:UpdateRecord",
      "version": 1,
      "filter": {
        "name": "An email was found",
        "conditions": [
          [
            {
              "a": "{{2.profile.email}}",
              "o": "exist"
            }
          ]
        ]
      },
      "parameters": {},
      "mapper": {
        "id": "{{1.id}}",
        "objectType": "contact",
        "properties": {
          "email": "{{2.profile.email}}"
        }
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0
        },
        "restore": {
          "parameters": {
            "__IMTCONN__": {}
          }
        }
      }
    }
  ],
  "metadata": {
    "instant": false,
    "version": 1,
    "designer": {
      "orphans": []
    },
    "scenario": {
      "dlq": false,
      "slots": null,
      "dataloss": false,
      "maxErrors": 3,
      "autoCommit": true,
      "roundtrips": 1,
      "sequential": false,
      "confidential": false,
      "freshVariables": false,
      "autoCommitTriggerLast": true
    }
  }
}
