Contact Property Update Agent

Written By William Bowen

Last updated 4 months ago

Intro

How can AI update my contact database? This agent does exactly that.
It reads your conversation history, searches for the data you want to extract, and updates this to your contact properties database.
In the image below, the AI has extracted the lead’s email address, first and last name and updated this to the Clerk Chat contact card.
I have my SalesForce integrated with this workspace, and this data is then synced back to my SalesForce (as you can see by the SalesForce logo).

What you need

  • Data point you want to extract (e.g. email address).

  • Description of this data point (e.g. ‘The user’s email address’).

  • Name of the data point in the contact card (e.g. Email).

  • AI Agent template, below.

Logic Diagram

Here’s the basic logic for the contact property update agent.

Here’s this logic fleshed out with the required Clerk Chat agent properties.

Transferring this to Clerk Chat Agent builder:

Template

Copy this template and put into your Clerk Chat workspace to get the agent outlined above.

Example
{ "$schema": "https://web-api.clerk.chat/pipeline-schema", "name": "Contact Property Update Agent", "nodes": [ { "type": "ai_bot", "name": "extract_contact_data", "triggeredBy": [ "unreadMessage.fromAny" ], "responseType": "json", "nodeConfig": { "modelProvider": "openai", "modelVersion": null, "maxTokens": null, "temperature": null, "variables": {}, "prompt": "# Role: \nYou are a data extraction node. Your job is to read the conversation and search for specific data, and extract this data when it is present. \n\n# Goal: \nYour goal is to extract the data below from the conversation. \n\n# Context: \nYou are reading an SMS conversation between a user (a human) and an AI Agent. Once you extract this data, another AI bot will update this data back to the contact properties of the user. This will then be synced back to SalesForce CRM. You are a crucial part of this flow. \n\nThe data you need to extract is: \n[data_point_1]: [description]\n\n# Instructions: \nRead the conversation history\nExtract each data point in order ([data_point_1], …)\nOutput each data point.", "promptSections": [], "sectionTemplates": {}, "responseSchema": { "type": "object", "required": [ "<data_point_1>" ], "properties": { "<data_point_1>": { "type": "string" } } }, "opts": { "sendStructuredConvo": true } } }, { "type": "tool_runner", "name": "update_contact_data", "triggeredBy": [ "unreadMessage.fromAny" ], "responseType": "json", "nodeConfig": { "type": "contact_tools", "config": {}, "enabledTools": [ "set_attribute" ], "tools": { "set_attribute": { "paramValues": { "attributeName": { "type": "fixed", "value": "<contact_property>" }, "attributeValue": { "path": "<extract_variable>", "type": "pipeline-variable" } } } } } }, { "type": "trigger", "name": "Start", "triggeredBy": [ "userMessage" ], "responseType": "json" } ], "edges": [ { "name": null, "filters": [], "sourceNode": "extract_contact_data", "destinationNode": "update_contact_data" }, { "name": null, "filters": [], "sourceNode": "Start", "destinationNode": "extract_contact_data" } ] }

Walkthrough Video