Packbase

Howl

TypeScript shapes for howls, creation input, interactions, assets, and jobs.

Howl

Howl describes a post that Packbase returns. Many fields are optional because endpoints return different levels of detail. A field that ends in ? can be absent. Check the field or use optional chaining before you read it.

interface Howl {
  id: string
  rehowl_id?: string
  canonical_id?: string
  parent_post?: unknown
  tenant_id?: string
  content_type: 'text' | 'howling_alongside' | 'howling_echo'
  created_at: string
  body?: string
  allow_rehowl?: boolean
  rehowled_by?: Profile
  user: Profile
  assets?: HowlAsset[]
  tags?: string[]
  reactions?: HowlReaction[]
  comments?: HowlComment[]
  pack?: Pack
  warning?: { reason: string }
  meta?: {
    rehowled: boolean
    pinned?: boolean
    pin_expires_at?: string
    folder_count?: number
  }
}

parent_post can contain the original post for quote howls. Its structure is not stable, and its type is unknown. Check the value before you use it. rehowled_by identifies the account that rehowled the post when this data is available.

Content and ratings

type HowlContentType = 'text' | 'howling_alongside' | 'howling_echo'
type HowlRating =
  | 'rating_safe'
  | 'rating_mature'
  | 'rating_suggestive'
  | 'rating_explicit'

Howls that you create directly use text. The other values describe rehowls from the API. Each creation request requires exactly one rating tag. This tag can occur at any position in the list.

Assets, reactions, and comments

interface HowlAsset {
  type: 'image' | 'video' | 'audio' | 'file'
  data: { name?: string; url: string }
}

interface HowlReaction {
  key: string
  emoji: string
  count: number
  reactedByMe?: boolean
}

interface HowlComment {
  id: string
  body: string
  user: Profile
  created_at: string
  content_type: string
  reactions?: HowlReaction[]
  comments?: HowlComment[]
}

HowlCreateInput

Pass this object to pb.howls.create(). It contains fewer fields than Howl. Supply only the data necessary to create a post. Packbase supplies fields such as id, created_at, and user.

interface HowlCreateInput {
  tenant_id: string
  parent_id?: string
  content_type?: 'text'
  body: string | null
  asset_ids?: string[]
  tags: [string, ...string[]]
}

body must be a string or null. Do not use a structured JSON object. Packbase sanitizes HTML in strings. Use null only when asset_ids supplies the howl content.

Creation jobs

By default, pb.howls.create() waits and returns a completed Howl. With { poll: false }, it returns the smaller HowlCreationJob:

interface HowlCreationJob {
  id: string
}

The job ID is also the future howl ID. Each status check returns this shape:

interface HowlJobStatus {
  id: string
  status:
    | 'pending'
    | 'uploading'
    | 'converting'
    | 'processing'
    | 'completed'
    | 'failed'
  progress: {
    currentAsset: number
    totalAssets: number
    currentAssetProgress?: number
  }
  createdAt: number
  updatedAt: number
  error?: string
}

Import

import type {
  Howl,
  HowlCreateInput,
  HowlCreationJob,
  HowlJobStatus,
  HowlContentType,
  HowlRating,
  HowlAsset,
  HowlReaction,
  HowlComment,
} from '@packbase/sdk-ts'

On this page