{ "kind": "open-flow-workflow", "version": 1, "name": "Verify HighLevel Contact Mailing Address", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_f5ab7e4c577ee31f": { "name": "Receive a contact", "kind": "webhook", "bodyFields": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "address" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "address2" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "city" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "state" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "zip_code" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "email" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "phone" } ], "method": "POST" }, "n_bfb6bb4b72b23135": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f5ab7e4c577ee31f", "output": "body" } ] }, "locationId": { "kind": "value", "value": "YOUR_LOCATION_ID" } }, "name": "Prepare address and contact", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "locationId" } ], "outputs": [ { "jsonSchema": { "type": "string", "minLength": 1, "description": "The primary street address line." }, "nullable": false, "handle": "primary" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The secondary address line, such as an apartment, suite, or unit." }, "nullable": true, "handle": "secondary" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The city name for the address." }, "nullable": true, "handle": "city" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The US state or region for the address." }, "nullable": true, "handle": "state" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The US ZIP or ZIP+4 code for the address." }, "nullable": true, "handle": "zip" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "contact" } ], "name": "Prepare address and contact", "moduleId": "n_0885d9d7a7c52b79", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b0ccd1e712fc53a3": { "inputs": { "primary_line": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_bfb6bb4b72b23135", "output": "primary" } ] }, "secondary_line": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_bfb6bb4b72b23135", "output": "secondary" } ] }, "city": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_bfb6bb4b72b23135", "output": "city" } ] }, "state": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_bfb6bb4b72b23135", "output": "state" } ] }, "zip_code": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_bfb6bb4b72b23135", "output": "zip" } ] } }, "name": "Verify the US address", "kind": "task", "task": { "inputs": [ { "description": "The primary street address line.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The primary street address line." }, "nullable": false, "handle": "primary_line" }, { "description": "The secondary address line, such as an apartment, suite, or unit.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The secondary address line, such as an apartment, suite, or unit." }, "nullable": true, "handle": "secondary_line", "value": null }, { "description": "The city name for the address.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The city name for the address." }, "nullable": true, "handle": "city", "value": null }, { "description": "The US state or region for the address.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The US state or region for the address." }, "nullable": true, "handle": "state", "value": null }, { "description": "The US ZIP or ZIP+4 code for the address.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The US ZIP or ZIP+4 code for the address." }, "nullable": true, "handle": "zip_code", "value": null }, { "description": "The recipient name associated with the address.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The recipient name associated with the address." }, "nullable": true, "handle": "recipient", "value": null } ], "outputs": [ { "description": "A Lob address verification object.", "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A Lob address verification object." }, "nullable": false, "handle": "verification" } ], "name": "Verify the US address", "executor": { "kind": "connector", "action": "lob.verify_us_address" } } }, "n_4b028793f35af088": { "inputs": { "verification": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b0ccd1e712fc53a3", "output": "verification" } ] }, "contact": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_bfb6bb4b72b23135", "output": "contact" } ] } }, "name": "Choose the deliverability tag", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A Lob address verification object." }, "nullable": false, "handle": "verification" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "contact" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "tag" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "deliverability" } ], "name": "Choose the deliverability tag", "moduleId": "n_f9a1dd84d98fd50b", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b6cf51deb79945e5": { "inputs": { "endpoint": { "kind": "value", "value": "/contacts/upsert" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4b028793f35af088", "output": "body" } ] } }, "name": "Find or create the contact", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": {}, "nullable": true, "handle": "body" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" }, { "jsonSchema": { "const": "base64" }, "nullable": true, "handle": "bodyEncoding" } ], "name": "Find or create the contact", "executor": { "providerId": "high_level", "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "kind": "connector-proxy" } } }, "n_df968ac69a41afdd": { "inputs": { "response": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b6cf51deb79945e5", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b6cf51deb79945e5", "output": "statusCode" } ] }, "tag": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4b028793f35af088", "output": "tag" } ] }, "deliverability": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4b028793f35af088", "output": "deliverability" } ] } }, "name": "Confirm the contact", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "response" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "tag" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "deliverability" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "tag" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "deliverability" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "contactId" } ], "name": "Confirm the contact", "moduleId": "n_6b77506c4d62690c", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_1fee39a1173c8ac0": { "inputs": { "endpoint": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_df968ac69a41afdd", "output": "endpoint" } ] }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_df968ac69a41afdd", "output": "body" } ] } }, "name": "Add the tag", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": {}, "nullable": true, "handle": "body" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" }, { "jsonSchema": { "const": "base64" }, "nullable": true, "handle": "bodyEncoding" } ], "name": "Add the tag", "executor": { "providerId": "high_level", "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "kind": "connector-proxy" } } }, "n_d60fa9ec4672f641": { "inputs": { "response": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_1fee39a1173c8ac0", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_1fee39a1173c8ac0", "output": "statusCode" } ] }, "tag": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_df968ac69a41afdd", "output": "tag" } ] }, "deliverability": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_df968ac69a41afdd", "output": "deliverability" } ] }, "contactId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_df968ac69a41afdd", "output": "contactId" } ] } }, "name": "Confirm the tag", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "response" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "tag" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "deliverability" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "contactId" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "result" } ], "name": "Confirm the tag", "moduleId": "n_d644c800bc79e3ca", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_243b1afe3146d0c7": { "name": "Verification result", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "result" } ], "outputMappings": { "result": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d60fa9ec4672f641", "output": "result" } ] } } } }, "edges": [ { "source": "n_f5ab7e4c577ee31f", "target": "n_bfb6bb4b72b23135" }, { "source": "n_bfb6bb4b72b23135", "target": "n_b0ccd1e712fc53a3" }, { "source": "n_b0ccd1e712fc53a3", "target": "n_4b028793f35af088" }, { "source": "n_4b028793f35af088", "target": "n_b6cf51deb79945e5" }, { "source": "n_b6cf51deb79945e5", "target": "n_df968ac69a41afdd" }, { "source": "n_df968ac69a41afdd", "target": "n_1fee39a1173c8ac0" }, { "source": "n_1fee39a1173c8ac0", "target": "n_d60fa9ec4672f641" }, { "source": "n_d60fa9ec4672f641", "target": "n_243b1afe3146d0c7" } ] } }, "modules": { "n_0885d9d7a7c52b79": { "name": "Prepare address and contact", "imports": [], "source": "export default function prepare({body,locationId}){const b=body??{},email=typeof b.email==='string'?b.email.trim():'',phone=typeof b.phone==='string'?b.phone.trim():'';if(!email&&!phone)throw Error('Contact email or phone is required');if(typeof b.address!=='string'||!b.address.trim())throw Error('A primary address is required');if(typeof locationId!=='string'||!locationId.trim()||locationId==='YOUR_LOCATION_ID')throw Error('Configure the HighLevel location ID');const city=typeof b.city==='string'&&b.city.trim()?b.city.trim():null,state=typeof b.state==='string'&&b.state.trim()?b.state.trim():null,zip=typeof b.zip_code==='string'&&b.zip_code.trim()?b.zip_code.trim():null;if(!zip&&!(city&&state))throw Error('Provide ZIP or both city and state');const secondary=typeof b.address2==='string'&&b.address2.trim()?b.address2.trim():null;return{primary:b.address.trim(),secondary,city,state,zip,contact:{locationId:locationId.trim(),...(email?{email}:{}),...(phone?{phone}:{})}}}\n" }, "n_f9a1dd84d98fd50b": { "name": "Choose the deliverability tag", "imports": [], "source": "export default function plan({verification,contact}){const d=verification?.deliverability,allowed=['deliverable','deliverable_unnecessary_unit','deliverable_incorrect_unit','deliverable_missing_unit','undeliverable'];if(!allowed.includes(d))throw Error('Lob did not return a recognized deliverability status');const tag=d==='deliverable'?'Mailing Address Deliverable':'Mailing Address NOT Deliverable';return{body:contact,tag,deliverability:d}}\n" }, "n_6b77506c4d62690c": { "name": "Confirm the contact", "imports": [], "source": "export default function contact({response,statusCode,tag,deliverability}){if(statusCode<200||statusCode>=300||typeof response?.contact?.id!=='string'||!response.contact.id)throw Error('HighLevel contact upsert was not confirmed; inspect before retrying');return{endpoint:'/contacts/'+encodeURIComponent(response.contact.id)+'/tags',body:{tags:[tag]},tag,deliverability,contactId:response.contact.id}}\n" }, "n_d644c800bc79e3ca": { "name": "Confirm the tag", "imports": [], "source": "export default function confirm({response,statusCode,tag,deliverability,contactId}){if(statusCode<200||statusCode>=300||!Array.isArray(response?.tags)||!response.tags.includes(tag))throw Error('HighLevel tag was not confirmed; inspect the contact before retrying');return{result:{contactId,deliverability,tag}}}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }