Feeds
Every feed is a flat, reverse-chronological timeline of activities — no ranking, no
aggregation. A feed read is exactly three statements on the backend, constant in page
size, no matter how many activities exist (spec §6). Feeds are addressed by
(group, id), e.g. timeline:maya or user:maya.
Read a feed
Section titled “Read a feed”import { DropInClient } from '@dropin/client'
const client = new DropInClient({ url, apiKey, tokenProvider })
const page = await client.feed('user', 'maya').get({ limit: 20 })page.results // Activity[] — newest firstpage.next // opaque cursor, or null when there's no moreimport { useFeed } from '@dropin/react'
function Feed() { const { activities, isLoading, error, hasNext, loadNext, refresh } = useFeed('user', 'maya') // activities: Activity[], hasNext: boolean, loadNext(): fetch the next page and append if (isLoading) return <p>Loading…</p> return <ul>{activities.map((a) => <li key={a.id}>{a.verb}</li>)}</ul>}import { DropInServer } from '@dropin/server'
const server = new DropInServer({ tenantId, apiKey, apiSecret, url })
const page = await server.feed('user', 'maya').get({ limit: 20 })Read a user feed
Section titled “Read a user feed”user:<id> is a single user’s own posts. The client and react hooks expose sugar for it;
DropInServer only has the generic feed(group, id) — there’s no userFeed shortcut
server-side.
// client.userFeed(id) is sugar for client.feed('user', id)const page = await client.userFeed('maya').get({ limit: 20 })import { useUserFeed } from '@dropin/react'
const { activities, isLoading, hasNext, loadNext } = useUserFeed('maya')// No userFeed() sugar on DropInServer — use the generic feed() with group 'user'.const page = await server.feed('user', 'maya').get({ limit: 20 })Read the following timeline
Section titled “Read the following timeline”timeline:<id> aggregates activities from every feed <id> follows (spec §1) — the
“who I follow” feed. Same sugar pattern as userFeed.
// client.timeline(id) is sugar for client.feed('timeline', id)const page = await client.timeline('maya').get({ limit: 20 })import { useTimeline } from '@dropin/react'
const { activities, isLoading, hasNext, loadNext } = useTimeline('maya')const page = await server.feed('timeline', 'maya').get({ limit: 20 })Read a flat/explore feed
Section titled “Read a flat/explore feed”There’s no special “explore” concept in the SDK — it’s an ordinary feed, conventionally
named e.g. flat:explore, that other feeds follow so their posts fan out into one global
timeline (this is exactly how the showcase app’s Explore tab works — see
apps/showcase/lib/seed.ts).
const page = await client.feed('flat', 'explore').get({ limit: 20 })import { useFeed } from '@dropin/react'
const { activities, isLoading, hasNext, loadNext } = useFeed('flat', 'explore')const page = await server.feed('flat', 'explore').get({ limit: 20 })See pagination for how next and loadNext() work across pages,
and activities for posting into a feed.