Skip to content

Reddit social adapter package #97

@arberx

Description

@arberx

Summary

Implement the Reddit social platform adapter as the first social monitoring integration.

Details

Create packages/social-reddit/ implementing SocialPlatformAdapter:

  • Auth: OAuth 2.0 client credentials flow (app-only). User provides Reddit app client ID and secret.
  • Search: Uses Reddit JSON API (/search.json) with queries:
    • url:example.com — find link posts sharing the domain
    • "brand keyword" — find text mentions
  • Rate limits: 100 req/min with OAuth (very generous)
  • Cost: Free
  • Data extracted: Post title, body, score, comment count, upvote ratio, subreddit, author, permalink, creation time

Package structure

packages/social-reddit/
  src/adapter.ts      -- implements SocialPlatformAdapter
  src/normalize.ts     -- Reddit API response → SocialMentionResult[]
  src/types.ts         -- Reddit API response types
  src/index.ts         -- re-exports
  test/index.test.ts
  package.json         -- @ainyc/canonry-social-reddit
  tsconfig.json
  tsup.config.ts
  vitest.config.ts

Depends on

  • Social contracts issue

Acceptance Criteria

  • Adapter validates config (requires clientId + clientSecret)
  • Healthcheck verifies Reddit API connectivity
  • searchMentions() returns normalized SocialMentionResult[]
  • Deduplication by external_id
  • Unit tests with mocked Reddit API responses
  • pnpm run typecheck and pnpm run test pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    phase-aPhase A: Foundation + RedditsocialSocial platform monitoringswarm-readyIssue is ready for the automated swarm to pick up

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions