Skip to main content

Built and signed on GitHub Actions

An ActivityPub/fediverse server framework

This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
a week ago (1.3.0)
method Federation.setInboxListeners
Federation.setInboxListeners(
inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`,
sharedInboxPath?: string,
): InboxListenerSetters<TContextData>

Assigns the URL path for the inbox and starts setting inbox listeners.

Examples

Example 1

federation
  .setInboxListeners("/users/{identifier}/inbox", "/inbox")
  .on(Follow, async (ctx, follow) => {
    const from = await follow.getActor(ctx);
    if (!isActor(from)) return;
    // ...
  })
  .on(Undo, async (ctx, undo) => {
    // ...
  });

Parameters

inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`

The URI path pattern for the inbox. The syntax is based on URI Template (RFC 6570). The path must have one variable: {identifier}, and must match the inbox dispatcher path.

optional
sharedInboxPath: string

An optional URI path pattern for the shared inbox. The syntax is based on URI Template (RFC 6570). The path must have no variables.

Return Type

InboxListenerSetters<TContextData>

An object to register inbox listeners.

Throws

RouteError

Thrown if the path pattern is invalid.

Add Package

deno add jsr:@fedify/fedify

Import symbol

import { type Federation } from "@fedify/fedify";

---- OR ----

Import directly with a jsr specifier

import { type Federation } from "jsr:@fedify/fedify";

Add Package

npx jsr add @fedify/fedify

Import symbol

import { type Federation } from "@fedify/fedify";

Add Package

yarn dlx jsr add @fedify/fedify

Import symbol

import { type Federation } from "@fedify/fedify";

Add Package

pnpm dlx jsr add @fedify/fedify

Import symbol

import { type Federation } from "@fedify/fedify";

Add Package

bunx jsr add @fedify/fedify

Import symbol

import { type Federation } from "@fedify/fedify";