Packbase

Howls

Create Packbase posts, work with their background jobs, and add interactions.

A howl is a post on Packbase. Every howl belongs to a pack, which is a Packbase community. A howl can contain text, sanitized HTML, uploaded media, or a mix of those.

This guide starts with text howls. It then explains rating tags, uploads, and background processing.

Fetching a single howl

const  = await .('howl-uuid')

.(.)
.(.)
.(..)
.(.)

Replace 'howl-uuid' with a howl ID. pb.howls('howl-uuid') creates a HowlHandle. It does not make a request until you await it. The result is a Howl object. This object contains the post, its author, and related data from the endpoint.

Creating a howl

A howl can require media processing. Thus, Packbase does the work in a background job. By default, pb.howls.create() starts the job and checks its status. The method returns when the completed howl is available.

const  = await ..({
  : 'your-pack-uuid',  // required: the pack to post in
  : '<p>Hello from the SDK! 🐾</p>',
  : ['rating_safe'],        // must include exactly one rating tag
})

.(.) // the finished Howl

tenant_id is the ID of the pack receiving the howl (the server calls pack IDs “tenant IDs” in this request). The current user must be allowed to post there.

Required fields

TypeScript shows missing fields in your editor. The table describes each field:

FieldTypeDescription
tenant_idstringUUID of the pack to post into.
content_type'text'Optional. Authored howls always use 'text'; omitted values default to 'text'.
bodystring | nullPlain text or HTML. The server sanitizes HTML. Use null for asset-only howls.
tags[string, ...string[]]Must contain exactly one rating tag.

Rating tags

Each howl requires exactly one rating tag. Clients use this tag to present the content. The rating tag can occur at any position in the tags array:

TagMeaning
rating_safeSafe for all audiences
rating_matureMature content (non-explicit)
rating_suggestiveSuggestive content
rating_explicitExplicit / adult content
// Safe howl with additional tags
const : [string, ...string[]] = ['art', 'digital', 'rating_safe']

// Mature howl
const : [string, ...string[]] = ['rating_mature', 'gore']

Attaching uploaded assets

Use pb.howls.upload to initialize an asset, append one or more binary segments, finalize it, and inspect its status. Upload response bodies are currently JsonObject because the server has not published stable response schemas.

await ...({ : ., : . })
await ...({
  ,
  : 0,
  : ,
  : 'upload.bin',
})
await ...()
const  = await ...()

The SDK supplies the protocol commands. It sends appended assets as multipart FormData. After finalization, pass the returned asset IDs to howl creation:

const  = await ..({
  : 'pack-uuid',
  : null,
  : ['rating_safe'],
  : ['asset-uuid-1', 'asset-uuid-2'],
})

Tracking creation progress

Pass an onProgress callback when your interface needs to show what the background job is doing:

const  = await ..(
  {
    : 'pack-uuid',
    : null,
    : ['rating_safe'],
    : ['asset-uuid'],
  },
  {
    : (: HowlJobStatus) => {
      const { ,  } = .
      .(`Processing asset ${} / ${}`)
    },
  },
)

Manual polling

To store the pending job and check it later, pass { poll: false }. The method immediately returns the job ID. It does not wait for a completed Howl:

const  = await ..(
  { : 'pack-uuid', : 'hi', : ['rating_safe'] },
  { : false },
)

// job.id === the howl's future UUID
// Poll GET /howl/create/status/:id manually (or use a Poller directly)
.('Job started:', .)

Deleting a howl

await .('howl-id').()

Reacting

// Add a reaction
await .('howl-id').('🔥')

// Remove your reactions from the howl
await .('howl-id').()

If you add the same reaction two times, the server returns a 400 error. react() adds a reaction. It does not toggle a reaction. Call unreact() to remove the current user's reactions.

Commenting

const { :  } = await .('howl-id').('Great post!')

Rehowling (repost)

const { :  } = await .('howl-id').()

Reporting a howl

ReportReason contains the report categories that the API accepts. The optional second argument is a note for moderators. Use it to give information that is not in the category.

// Report with a reason
await .('howl-id').(.)

// Report with a reason and additional notes
await .('howl-id').(., 'Link to source material.')

Available reasons:

Enum valueSent to server
ReportReason.Spam'Spam'
ReportReason.HarassmentOrBullying'Harassment or bullying'
ReportReason.HateSpeechOrDiscrimination'Hate speech or discrimination'
ReportReason.Misinformation'Misinformation'
ReportReason.SexualContent'Sexual content'
ReportReason.ViolenceOrThreats'Violence or threats'
ReportReason.SelfHarm'Self-harm'
ReportReason.Other'Other'

Content types

content_typeDescription
textAuthored or asset-only howl. The body is plain text or sanitized HTML.
howling_alongsideA collaborative repost with separate body.
howling_echoA plain echo/repost with no extra body.

Packbase can return howling_alongside and howling_echo in response data. You cannot use them to create a howl with this method. Pass text, or omit content_type. If you omit it, the SDK supplies text.

On this page