Skip to content

Reviews schema: externalId dedupe, persist pull, cron ingest, auto-draft (TEL-8) - #295

Merged
telivity-otaip merged 3 commits into
mainfrom
cursor/reviews-ingest-dedupe-5232
Aug 9, 2026
Merged

Reviews schema: externalId dedupe, persist pull, cron ingest, auto-draft (TEL-8)#295
telivity-otaip merged 3 commits into
mainfrom
cursor/reviews-ingest-dedupe-5232

Conversation

@telivity-otaip

Copy link
Copy Markdown
Collaborator

Summary

Implements TEL-8: review ingest persistence with deduplication, automatic review_response drafting, scheduled pull endpoint, and Channex review webhooks.

Changes

Schema

  • Added external_id, external_url, provider_place_id, provider_location_id, provider_channel_id, and last_synced_at on guest_reviews
  • Unique index on (property_id, source, external_id) for ingest dedupe
  • Migration 0018_guest_reviews_external_id.sql + push-schema.ts updates

Ingest pipeline

  • ReviewsIngestService persists pulled/webhook reviews with insert-on-conflict dedupe
  • Re-sync updates content and last_synced_at without creating duplicates
  • Emits guest.review.ingested for new rows

Auto-draft

  • ReviewIngestListener runs review_response agent on ingest events (pull, cron, Channex)

Scheduling

  • POST /api/v1/reviews/ingest?propertyId= for external hourly cron (Google + TripAdvisor when configured)
  • Documented in docs/operations/cron.md

Channex

  • POST /api/v1/channels/inbound/channex/reviews handles review webhook events
  • Maps OTA payloads (Booking.com, Expedia, etc.) into guest_reviews

API response

  • POST /reviews/pull now returns imported, updated, and newReviewIds alongside pull results

Acceptance

  • Ingested reviews land in DB once; re-sync does not duplicate
  • New reviews get AI/template draft without manual paste
  • TripAdvisor pull remains env-gated (not productized beyond existing adapter)

Testing

  • reviews-ingest.service.spec.ts
  • reviews.service.spec.ts
  • channex-review.mapper.spec.ts
  • pnpm --filter @telivityhaip/api typecheck

Linear Issue: TEL-8

Open in Web Open in Cursor 

…ex webhook

- Add externalId, externalUrl, provider ids, lastSyncedAt on guest_reviews
- Unique index on (property_id, source, external_id) for ingest dedupe
- Persist pull results via ReviewsIngestService with re-sync updates
- Emit guest.review.ingested and auto-run review_response agent
- POST /reviews/ingest for hourly external cron
- POST /channels/inbound/channex/reviews for Channex review events

TEL-8

Co-authored-by: telivity-otaip <telivity-otaip@users.noreply.github.com>
@telivity-otaip
telivity-otaip marked this pull request as ready for review August 9, 2026 17:58
cursoragent and others added 2 commits August 9, 2026 18:01
Co-authored-by: telivity-otaip <telivity-otaip@users.noreply.github.com>
Resolve conflicts:
- README.md / docs/test-stats.json: re-sync test counts (1458 tests, 206 files)
- docs/operations/cron.md: keep both guest_comms daily cron (main) and
  hourly review ingest cron (TEL-8)

Co-authored-by: telivity-otaip <telivity-otaip@users.noreply.github.com>
@telivity-otaip
telivity-otaip merged commit 0fd0555 into main Aug 9, 2026
5 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.

2 participants