Skip to content

Quickstart

  1. Install the SDK.

    Terminal window
    pnpm add @dropin/client @dropin/server
  2. Mint a user token on your backend. dropin issues no tokens — your backend signs an HS256 JWT with your tenant api_secret. This never runs in the browser.

    // server-only — never bundle this into a browser build
    import { DropInServer } from '@dropin/server'
    const server = new DropInServer({
    tenantId: process.env.DROPIN_TENANT_ID!,
    apiKey: process.env.DROPIN_API_KEY!,
    apiSecret: process.env.DROPIN_API_SECRET!,
    url: 'https://api.getnodex.cloud',
    })
    // Inside your own token endpoint, after you've authenticated the caller:
    const token = await server.createUserToken(userId, { expiresIn: '1h' })
  3. Construct a client with that token and read a feed.

    import { DropInClient } from '@dropin/client'
    const client = new DropInClient({
    url: 'https://api.getnodex.cloud',
    apiKey: process.env.NEXT_PUBLIC_DROPIN_API_KEY!,
    // Called on init and again on a 401 — fetch a fresh token from your backend endpoint.
    tokenProvider: async () => {
    const res = await fetch('/api/token')
    const { token } = await res.json()
    return token
    },
    })
    const page = await client.feed('user', userId).get({ limit: 20 })
    page.results // Activity[] — newest first
    page.next // opaque cursor, or null when there's no more

Next: the integration walkthrough builds a complete feed screen.