A 'sophisticated' Facebook Marketplace alert system using GitHub Actions and ChatGPT's API
If The Castle (1997) was filmed today, would Steve Kerrigan instead be endlessly scrolling through Facebook Marketplace and forever sending screenshots of jousting sticks to the Kerrigan family WhatsApp group?
The Facebook Marketplace app includes a feature that notifies you when a listing matches a specified keyword.
Unfortunately this feature is poorly executed, appearing more intent on driving app engagement with false positive alerts than truly helping users find what they’re searching for.
Defining the problem
The Facebook Marketplace ‘new listing’ notification feature:
- Is inaccurate
- Is untimely
- Only notifies you through the app or by visiting the website
The solution
Drawing inspiration from Simon Willison’s brilliant post on (and coining of) Git scraping, I built an open source alert system running on GitHub Actions and applied ‘innovative’ filtering using ChatGPT’s API.
Example: Hali Rugs
This configuration will monitor and alert for Hali rug listings that are 2.8m by 2.3m with a 20% tolerance in dimensions.
Basic filtering (shown in the first yellow diamond) is applied to ensure that either the listing title or description contains the word 'hali'
.
This is required because Facebook Marketplace will sometimes insert ‘relevant’ listings that don’t necessarily match the specific keyword, and so these can be filtered out using basic string matching.
Side note: a simple string filter is also a way to save on usage costs of the ChatGPT API in the next step.
Then (shown in the second yellow diamond), the ChatGPT API is used to transform the listing title and description into a more structured format that can be used by Python.
The prompt sent to the ChatGPT API is shown below. It also defines how the API must return a response.
The dimensions can then be tested against the target dimensions.
If the listing meets the target dimensions, an email notification containing the URL to the Facebook listing is triggered.
Example: Grange Furniture
This configuration will monitor and alert for any Grange furniture listings.
Unfortunately, there is a furniture store located on Grange Rd
, Cheltenham and some other furniture is listed as Grange style
. This would otherwise result in false-positive listings making it through to the second-stage filter and racking up unnecessary ChatGPT API usage costs.
The preliminary filter below ensures that API costs are kept to a minimum.
Next, given the term 'grange'
is popular amongst wine and Holden Special Vehicle (HSV) enthusiasts, the ChatGPT API is used to indicate whether the listing is a piece of furniture.
End
Feel free to fork and modify either repository (linked in the examples above) to set up your own Facebook Marketplace alerts!