Getting Started
Installation
Installation
[Overview](../) · Getting Started
Package availability
Install @iconical/presence from npm once the version is published. If it is not available, use the local tarball workflow below.
Install the PresenceKit SDK, choose the right framework entrypoint, and verify that your project can read opt-in presence information.
Requirements
- A JavaScript or TypeScript application; browser projects typically use a modern bundler.
- Node.js 18+ or Bun for environments that execute requests outside the browser.
- A Discord user who has joined the official PresenceKit server and approved sharing using
/confirm. - Network access to
https://presence-api.iconical.dev.
Install from npm
Choose one package manager:
bun add @iconical/presencepnpm add @iconical/presencenpm install @iconical/presenceyarn add @iconical/presenceNOTE
These commands require the package to have been published under
@iconical/presence. If it is not available yet, follow the local tarball steps below instead.
Install PresenceKit
bun add @iconical/presence
Choose an import
| Application | Import |
|---|---|
| Vanilla JS, TypeScript, Node, Astro or Angular | @iconical/presence |
| React / Next.js hooks | @iconical/presence/react |
| Vue / Nuxt composables | @iconical/presence/vue |
| Svelte / SvelteKit stores | @iconical/presence/svelte |
| Optional React UI cards | @iconical/presence/react-ui |
React, Vue and Svelte are optional peer dependencies. Install the one your application actually uses; you do not need all three.
Verify installation
import { createPresenceClient } from "@iconical/presence";
const client = createPresenceClient();
const result = await client.getPresence("123456789012345678");
console.log(result.availability);
console.log(result.profile.displayName);Replace the sample ID with the ID of a user who has explicitly enabled sharing. A 404 for an unapproved sample ID is expected and is not an installation failure. See Getting started for response handling.
Work with an unpublished version
If you are developing or testing PresenceKit before an npm release, build an actual package archive from the SDK repository root:
bun install
bun run build
bun pm pack --filename presencekit-local.tgzThen, from a separate consumer project, install the generated archive:
bun add /absolute/path/to/presencekit-local.tgzRepack and reinstall after SDK changes. This is a maintainer/developer workflow; ordinary npm consumers do not build PresenceKit.
TypeScript and framework setup
The distributed package includes compiled JavaScript and .d.ts declarations. No additional TypeScript compilation step is required for consumers. Next.js components using live React hooks must be client components ("use client"); Vue and Svelte live subscriptions also start in browser lifecycles.
Next steps
Continue to Getting started, or open the React, Vue, Svelte, or JavaScript guide for a framework-specific example.
Was this page helpful?