Quickly create data-driven marketing content for any home, with Plunk and OpenAI
top of page

Quickly create data-driven marketing content for any home, with Plunk and OpenAI



Summary


We recognize the significant impact that high-quality marketing campaigns have on real estate agents, leading to increased revenue and added value for their clients. The emergence of generative AI has simplified the process of content creation for agents, yet a common limitation is its inability to provide accurate data regarding specific properties and market statistics. Often, it resorts to fabricating information.

This developer example provides a CLI tool that leverages Plunk's APIs and OpenAI's API. Use this tool to generate marketing content with actual property and area data like the examples above. Now, you have the ability to equip agents with AI-generated, data-driven marketing content, helping them empower their clients to make informed decisions.



Requirements

  • Node.js: Make sure you have Node.js installed on your machine. You can download it from nodejs.org.

  • Test API key from Plunk

  • Example web app with CLI tool code

  • API key for OpenAI’s API (we access their API through our Azure account)



Steps to get the CLI tool working on your local machine


1. Download example web app a. Download the example web app and open it in your preferred code editor. b. The example web app contains sample code for all our current API products, as well as developer examples. c. Check out the README for documentation on the example web app.

2. Populate your env file with correct values a. In the README, go to the “Generate marketing content using AI and Plunk data” section. There is a link to the section in the Table of Contents of the README. b. Follow the instructions on what values to use with the env variables.

3. Change directories into the “generative-ai-cli" directory


cd plunk-components/examples/generative-ai-cli 

4. Install all dependencies


npm install 

5. Create a symbolic link to use “plunk-cli” command globally.

a. In the package.json file we have defined a command to execute ./cli.js and named it plunk-cli


plunk-cli

b. Run npm link to use the plunk-cli command instead of using ./cli.js “address string” to run the tool.


npm link

c. Instead, you can run plunk-cli “address string” to run the tool.


plunk-cli 'address string'

6. Choose a property and generate the marketing content for that specific home


plunk-cli “1570 Sage Ct Grand Rapids, MI 49525 




Code overview


There are essentially three steps to generate the marketing content using Plunk data and generative AI:


1. Get data from the Plunk Home Value API

2. Get data from the Real-Time Market Insights API

3. Query OpenAI’s API with data from Plunk APIs to generate marketing content



Get the current Plunk Home Value for a given property:

  • Address string is used to query the Address Search endpoint to get a list of potential property matches.

  • Validate that you have a good match and get the parcel_id for that property.

  • Use the parcel_id to query the home valuation endpoint to get the current valuation for the property.


Get Real-Time Market Insights based on where the home is located:

  • Use the ZIP code for the matched property to query any of the Market Insights endpoints.

  • There are technically 12 endpoints for which you can get three years of historical date-value data.

- Sales vs list price

- Sales vs list price 90-day moving average

- Median list price

- Median list price 90-day moving average

- Price per square foot

- Price per square foot 90-day moving average

- Inventory

- Inventory 90-day moving average

- Days of inventory

- Days of inventory 90-day moving average

- Median days on market

- Median days on market 90-day moving average

  • In this tool, we utilized data on median list price and price per square foot. We gathered two data points for each insight, the most current value and the value of the insight a year ago.





Query OpenAI’s API with Plunk data:

  • In this tool we used OpenAI’s API through our Microsoft Azure account.

  • Develop a prompt that utilizes the Plunk data to generate marketing content based on that specific home’s data.

  • Show usage data provided by the endpoint in the terminal with the total number of tokens used. Microsoft Azure OpenAI Service pricing.




Lastly


We hope that this developer example will not only save you time but also inspire innovative ways to leverage property data and generative AI. If you have any questions or feedback, please don't hesitate to contact us at developersupport@getplunk.com. We're eager to witness how you harness Plunk data to deliver enhanced value to your clients.



bottom of page