Authenticated Client
When To Use It
Section titled “When To Use It”Use createTipplyClient() when you need private account data or actions such as:
- dashboard and account reads
- profile and settings updates
- tip moderation and resend actions
- payout and report access
- realtime control commands such as
skipCurrent()
Create A Client
Section titled “Create A Client”import { createTipplyClient } from "tipply-sdk-ts";
const client = createTipplyClient({ authCookie: process.env.TIPPLY_AUTH_COOKIE!,});Auth Token Lifecycle
Section titled “Auth Token Lifecycle”The authenticated client can keep the session usable across longer scripts:
auth.refreshTokenOnRequests: defaults totrue; stores newauth_tokenvalues returned inSet-Cookieauth.refreshTokenEvery: disabled by default; when enabled, periodically refreshes the session through/userauth.reconnectTries: defaults to3; retries selected auth and transport failures
const client = createTipplyClient({ authCookie: process.env.TIPPLY_AUTH_COOKIE!, auth: { refreshTokenOnRequests: true, refreshTokenEvery: { intervalMs: 60_000 }, reconnectTries: 3, },});Call client.close() if you enabled background refresh and no longer need the client.
Common Workflows
Section titled “Common Workflows”Current user and profile
Section titled “Current user and profile”const me = await client.me.get();const profile = await client.profile.get();const hasPendingChanges = await client.profile.pendingChanges.check();Dashboard summary
Section titled “Dashboard summary”const [income, tipStats, points, recentTips] = await Promise.all([ client.dashboard.stats.income.get(), client.dashboard.stats.tips.get(), client.dashboard.points.get(), client.dashboard.tips.recent.list(),]);Tips and moderation
Section titled “Tips and moderation”const tips = await client.tips .list() .filter("amount") .search("microphone") .limit(10) .offset(0) .get();
await client.tips.sendTest({ message: "SDK test tip", amount: 1500,});Goal management
Section titled “Goal management”import { asTemplateId } from "tipply-sdk-ts";
const goal = await client.goals.create({ title: "New microphone", target: 50_000, initialValue: 0, withoutCommission: false, templateId: asTemplateId("template-123"),});
await client.goals.id(goal.id).reset();Alert control
Section titled “Alert control”import { asTipId } from "tipply-sdk-ts";
await client.tips.id(asTipId("tip-123")).resend();await client.tipAlerts.skipCurrent();Clone The Client For Another Session
Section titled “Clone The Client For Another Session”const baseClient = createTipplyClient({ authCookie: process.env.TIPPLY_AUTH_COOKIE!,});
const anotherClient = baseClient.withAuthCookie(process.env.OTHER_TIPPLY_AUTH_COOKIE!);You can also replace the whole session strategy:
const anotherClient = baseClient.withSession({ getAuthCookie: async () => process.env.OTHER_TIPPLY_AUTH_COOKIE,});Namespaces
Section titled “Namespaces”medashboardprofilepaymentMethodssettingsgoalstemplatestipsmoderatorsmediawithdrawalsreportstipAlertspublic