Examples
Repository Examples
Section titled “Repository Examples”Maintained runnable examples live in apps/sdk/examples:
dashboard-summary.tspublic-profile.tspublic-goal-widget.tstip-controls.tstip-alerts-listener.tsplayground.local.ts
Dashboard Summary
Section titled “Dashboard Summary”import { createTipplyClient } from "tipply-sdk-ts";
const client = createTipplyClient({ authCookie: process.env.TIPPLY_AUTH_COOKIE!,});
const [me, income, points, recentTips] = await Promise.all([ client.me.get(), client.dashboard.stats.income.get(), client.dashboard.points.get(), client.dashboard.tips.recent.list(),]);
console.log(me.username, income.total, points, recentTips.length);Public Goal Widget
Section titled “Public Goal Widget”import { asGoalId, createTipplyClient } from "tipply-sdk-ts";
const client = createTipplyClient({ authCookie: process.env.TIPPLY_AUTH_COOKIE!,});const me = await client.me.get();const user = client.public.user(me.id);
const widget = await user.goals.id(asGoalId("goal-123")).widget.get();
console.log(widget.config.title, widget.stats.amount);Public Profile By Slug
Section titled “Public Profile By Slug”import { createTipplyClient } from "tipply-sdk-ts";
const client = createTipplyClient({ authCookie: process.env.TIPPLY_AUTH_COOKIE!,});
const profile = await client.profile.public("przxmus").get();
console.log(profile.nickName, profile.voiceMessageMinimalAmount);profile.public(slug).get() no longer returns the user’s internal id.
TIP_ALERT Listener
Section titled “TIP_ALERT Listener”import { createTipplyPublicClient } from "tipply-sdk-ts/public";
const listener = createTipplyPublicClient().tipAlerts.fromWidgetUrl( "https://widgets.tipply.pl/TIP_ALERT/user-123",);
listener.on("donation", (donation) => { console.log(`${donation.nickname}: ${donation.amount}`);});
await listener.connect();Tip Controls
Section titled “Tip Controls”import { asTipId, createTipplyClient } from "tipply-sdk-ts";
const client = createTipplyClient({ authCookie: process.env.TIPPLY_AUTH_COOKIE!,});
await client.tips.id(asTipId("tip-123")).resend();await client.tipAlerts.skipCurrent();