Skip to content

Authenticated Client

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()
import { createTipplyClient } from "tipply-sdk-ts";
const client = createTipplyClient({
authCookie: process.env.TIPPLY_AUTH_COOKIE!,
});

The authenticated client can keep the session usable across longer scripts:

  • auth.refreshTokenOnRequests: defaults to true; stores new auth_token values returned in Set-Cookie
  • auth.refreshTokenEvery: disabled by default; when enabled, periodically refreshes the session through /user
  • auth.reconnectTries: defaults to 3; 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.

const me = await client.me.get();
const profile = await client.profile.get();
const hasPendingChanges = await client.profile.pendingChanges.check();
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(),
]);
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,
});
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();
import { asTipId } from "tipply-sdk-ts";
await client.tips.id(asTipId("tip-123")).resend();
await client.tipAlerts.skipCurrent();
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,
});
  • me
  • dashboard
  • profile
  • paymentMethods
  • settings
  • goals
  • templates
  • tips
  • moderators
  • media
  • withdrawals
  • reports
  • tipAlerts
  • public