Skip to main content

Overview

The Social Feed API provides social networking features including following customers and stores, activity feeds, product interactions, and social discovery. The feed respects privacy settings - private accounts only show content to followers. Location: convex/customers/feed.ts

Privacy Controls

The feed system respects customer privacy settings:
  • Private accounts (default): Content only visible to followers
  • Public accounts: Content visible to all users
  • Users can always see their own content regardless of privacy settings

Follow Customer

followerCustomerId
Id<'customers'>
required
Customer doing the following
targetCustomerId
Id<'customers'>
required
Customer to follow
await convex.mutation(api.customers.feed.followCustomer, {
  followerCustomerId: "c123456789",
  targetCustomerId: "c987654321"
});

Follow Store

followerCustomerId
Id<'customers'>
required
Customer following the store
storeId
Id<'stores'>
required
Store to follow
await convex.mutation(api.customers.feed.followStore, {
  followerCustomerId: "c123456789",
  storeId: "j123456789"
});

Like Product

productId
Id<'products'>
required
Product to like
customerId
Id<'customers'>
required
Customer ID
await convex.mutation(api.customers.feed.likeProduct, {
  productId: "p123456789",
  customerId: "c123456789"
});

Get Feed

Retrieve personalized activity feed for a customer. The feed respects privacy settings and only shows content the user is authorized to see.
customerId
Id<'customers'>
required
Customer ID (must be authenticated user)
paginationOpts
PaginationOptions
required
Pagination options
const feed = await convex.query(api.customers.feed.getFeed, {
  customerId: "c123456789",
  paginationOpts: { numItems: 20, cursor: null }
});

Feed Content Types

The feed includes these activity types (filtered by privacy):
  1. Price Updates: From followed stores and on liked products
  2. Product Likes: From followed customers (only if you also like the product)
  3. Product Shares: From followed customers
  4. Direct Shares: Shared directly to you (always visible regardless of privacy)
  5. New Products: From followed stores
{
  "page": [
    {
      "_id": "activity_123",
      "activityType": "product_liked",
      "productId": "p123456789",
      "storeId": "j123456789",
      "actorCustomerId": "c987654321",
      "actorCustomerName": "Jane Smith",
      "actorUsername": "janesmith",
      "actorAvatarUrl": "https://storage.convex.dev/jane.jpg",
      "productName": "Organic Apples",
      "productImage": "https://storage.convex.dev/apples.jpg",
      "storeName": "Fresh Market",
      "_creationTime": 1640995800000,
      "canView": true
    }
  ],
  "isDone": false,
  "continueCursor": "eyJfY3JlYXRpb25UaW1lIjoxNjQwOTk1ODAwMDAwfQ"
}
Social feed includes activity from followed customers and stores with real-time updates. Privacy-restricted content is automatically filtered out.