Skip to main content
This page covers the moderation and administrative functions on the spaces module: report handling, content moderation actions, community rules management, and digest newsletter configuration.

Reports

handleEntityReport

Resolves a report filed against an entity in a space by applying one or more moderation actions.
const result = await sublay.spaces.handleEntityReport({
  spaceId: "spc_abc123",
  reportId: "rpt_xyz789",
  entityId: "ent_xyz789",
  actions: ["remove-entity", "ban-user"],
  reason: "Repeated spam",
});
spaceId
string
required
The Sublay space ID where the report was filed.
reportId
string
required
The Sublay report ID.
entityId
string
required
The Sublay entity ID the report targets.
actions
string[]
required
One or more actions to apply: "remove-entity", "ban-user", and/or "dismiss".
summary
string
Optional moderator summary of the resolution.
reason
string
Optional reason, stored for audit purposes.
userId
string
The Sublay user ID of the moderator performing the action.
ReturnsPromise<HandleReportResponse>

handleCommentReport

Resolves a report filed against a comment in a space by applying one or more moderation actions.
const result = await sublay.spaces.handleCommentReport({
  spaceId: "spc_abc123",
  reportId: "rpt_abc456",
  commentId: "cmt_abc123",
  actions: ["dismiss"],
});
spaceId
string
required
The Sublay space ID where the report was filed.
reportId
string
required
The Sublay report ID.
commentId
string
required
The Sublay comment ID the report targets.
actions
string[]
required
One or more actions to apply: "remove-comment", "ban-user", and/or "dismiss".
summary
string
Optional moderator summary of the resolution.
reason
string
Optional reason, stored for audit purposes.
userId
string
The Sublay user ID of the moderator performing the action.
ReturnsPromise<HandleReportResponse>

Content Moderation

moderateSpaceEntity

Approves or removes an entity within a space.
const result = await sublay.spaces.moderateSpaceEntity({
  spaceId: "spc_abc123",
  entityId: "ent_xyz789",
  action: "remove",
  reason: "Violates community guidelines",
});
spaceId
string
required
The Sublay space ID.
entityId
string
required
The Sublay entity ID to moderate.
action
string
required
"approve" — makes the entity visible, or "remove" — hides/removes it from the space.
reason
string
Optional reason for the moderation action, stored for audit purposes.
ReturnsPromise<ModerationResponse>

moderateSpaceComment

Approves or removes a comment within a space.
const result = await sublay.spaces.moderateSpaceComment({
  spaceId: "spc_abc123",
  commentId: "cmt_abc123",
  action: "approve",
});
spaceId
string
required
The Sublay space ID.
commentId
string
required
The Sublay comment ID to moderate.
action
string
required
"approve" or "remove".
reason
string
Optional reason for the moderation action.
ReturnsPromise<ModerationResponse>

Rules

Rules are community guidelines displayed to members. They are ordered and each consists of a title and optional description.

fetchManyRules

Fetches all rules for a space.
const result = await sublay.spaces.fetchManyRules({ spaceId: "spc_abc123" });
spaceId
string
required
The Sublay space ID.
ReturnsPromise<FetchManyRulesResponse>

fetchRule

Fetches a single rule by its ID.
const rule = await sublay.spaces.fetchRule({
  spaceId: "spc_abc123",
  ruleId: "rul_xyz789",
});
spaceId
string
required
The Sublay space ID.
ruleId
string
required
The Sublay rule ID.
ReturnsPromise<Rule>

createRule

Creates a new rule for a space.
const rule = await sublay.spaces.createRule({
  spaceId: "spc_abc123",
  title: "Be respectful",
  description: "Treat all members with respect and courtesy.",
});
spaceId
string
required
The Sublay space ID.
title
string
required
Short title for the rule.
description
string
Extended explanation of the rule.
ReturnsPromise<Rule>

updateRule

Updates an existing rule’s title or description.
const rule = await sublay.spaces.updateRule({
  spaceId: "spc_abc123",
  ruleId: "rul_xyz789",
  title: "Be respectful and kind",
  description: "Updated description.",
});
spaceId
string
required
The Sublay space ID.
ruleId
string
required
The Sublay rule ID to update.
title
string
New title.
description
string
New description.
ReturnsPromise<Rule>

deleteRule

Deletes a rule from a space.
const result = await sublay.spaces.deleteRule({
  spaceId: "spc_abc123",
  ruleId: "rul_xyz789",
});
spaceId
string
required
The Sublay space ID.
ruleId
string
required
The Sublay rule ID to delete.
ReturnsPromise<DeleteRuleResponse>

reorderRules

Sets the display order of all rules for a space by providing an ordered array of rule IDs.
const rules = await sublay.spaces.reorderRules({
  spaceId: "spc_abc123",
  ruleIds: ["rul_first", "rul_second", "rul_third"],
});
spaceId
string
required
The Sublay space ID.
ruleIds
string[]
required
Complete ordered array of all rule IDs for the space.
ReturnsPromise<Rule[]> — the full list of rules in their new order.

Digest Newsletter

The digest feature allows a space to send a periodic newsletter-style webhook payload summarizing recent activity.

fetchDigestConfig

Fetches the current digest configuration for a space.
const config = await sublay.spaces.fetchDigestConfig({ spaceId: "spc_abc123" });
spaceId
string
required
The Sublay space ID.
ReturnsPromise<DigestConfig>

updateDigestConfig

Updates the digest configuration for a space.
const config = await sublay.spaces.updateDigestConfig({
  spaceId: "spc_abc123",
  digestEnabled: true,
  digestWebhookUrl: "https://example.com/webhooks/digest",
  digestWebhookSecret: "whsec_mySecret",
  digestScheduleHour: 9,
  digestTimezone: "America/New_York",
});
spaceId
string
required
The Sublay space ID.
digestEnabled
boolean
Enable or disable the digest webhook.
digestWebhookUrl
string
The URL that will receive the digest payload.
digestWebhookSecret
string
Secret used to sign the webhook payload for verification.
digestScheduleHour
number
Hour of day (0–23) at which the digest fires, in the configured timezone.
digestTimezone
string
IANA timezone identifier (e.g., "America/New_York", "Europe/London").
ReturnsPromise<DigestConfig>