Skip to content

feat: add Facebook Marketplace embeds - #99

Merged
rosethornbush merged 6 commits into
mainfrom
feat/platforms/facebook-marketplace
Sep 7, 2026
Merged

feat: add Facebook Marketplace embeds#99
rosethornbush merged 6 commits into
mainfrom
feat/platforms/facebook-marketplace

Conversation

@rosethornbush

Copy link
Copy Markdown
Contributor

adds Facebook Marketplace embeds with price, photos, listing age, and an approximate location map. access is controlled per Discord user through PostHog.

@changeset-bot

changeset-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0e0b477

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
embedly-docs 0e0b477 Commit Preview URL

Branch Preview URL
Sep 07 2026, 05:55 AM

@greptile-apps

greptile-apps Bot commented Sep 7, 2026

Copy link
Copy Markdown

Greptile Summary

Adds Facebook Marketplace URL support with listing details, photos, approximate-location maps, and per-Discord-user access control through PostHog.

  • Parses Marketplace listing data from Facebook’s embedded JSON.
  • Builds Marketplace-specific Discord components for price, media, location, map, and listing age.
  • Configures and shuts down the PostHog client with the bot lifecycle.
  • Keeps Marketplace access fail-closed when the feature flag is absent or unavailable.

Confidence Score: 5/5

The new changes since the previous review appear safe to merge, though the existing non-blocking concern about silently discarded access-denied Marketplace matches remains outstanding.

The post-review changes only introduce local aliases in Marketplace rendering and preserve existing behavior. The earlier unresolved finding remains: users denied Marketplace access receive no explicit access-related result because those matches are filtered out before response and update handling.

Files Needing Attention: apps/bot/src/lib/handleUrls.ts

Important Files Changed

Filename Overview
apps/bot/src/lib/handleUrls.ts Adds PostHog-based, fail-closed Marketplace access gating; the prior unresolved silent-denial behavior remains unchanged.
apps/bot/src/lib/builder.ts Renders Marketplace-specific listing metadata and includes behavior-preserving cleanup since the previous review.
apps/bot/src/lib/client.ts Initializes the optional PostHog client during login and shuts it down during client destruction.
packages/platforms/src/platforms/facebook-marketplace.ts Matches, fetches, parses, and normalizes Facebook Marketplace listings, photos, prices, and approximate map data.

Sequence Diagram

sequenceDiagram
    participant U as Discord user
    participant B as Embedly bot
    participant P as PostHog
    participant A as Embed API
    participant F as Facebook Marketplace

    U->>B: Submit Marketplace URL
    B->>P: Evaluate facebook-marketplace flag
    alt Access granted
        B->>A: Request Marketplace embed
        A->>F: Fetch listing page
        F-->>A: Listing JSON and photos
        A-->>B: Normalized listing
        B-->>U: Marketplace embed
    else Access denied or check unavailable
        B-->>B: Remove Marketplace match
    end
Loading

Reviews (3): Last reviewed commit: "fix(bot): preserve marketplace field nar..." | Re-trigger Greptile

Comment on lines +237 to +239
if (!hasAccess) {
matches = matches.filter((match) => match.platform !== "FacebookMarketplace");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Denied matches disappear silently

When a user lacks Marketplace access, this filter removes the valid match without recording why. Message requests then receive no response, interactions incorrectly report that no platform matched, and message updates can leave the existing bot embed stale because its update target is skipped. Handle denied matches explicitly so users receive an access-related result and updates are not silently abandoned.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/bot/src/lib/handleUrls.ts
Line: 237-239

Comment:
**Denied matches disappear silently**

When a user lacks Marketplace access, this filter removes the valid match without recording why. Message requests then receive no response, interactions incorrectly report that no platform matched, and message updates can leave the existing bot embed stale because its update target is skipped. Handle denied matches explicitly so users receive an access-related result and updates are not silently abandoned.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

@rosethornbush
rosethornbush merged commit 37c8972 into main Sep 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant