Skip to content

Packages  ›  trotsky  ›  StepCreatePost

StepCreatePost class

Represents step that creates a new post on Bluesky using the specified record parameters.

Signature:

typescript
export declare class StepCreatePost<P = StepBuilder, C = null, O extends StepCreatePostOutput = StepCreatePostOutput> extends Step<P, C, O>

Extends: Step<P, C, O>

Example 1

Create a simple text post:

ts
await Trotsky.init(agent)
  .createPost({ text: "Hello Bluesky! 👋" })
  .run()

Example 2

Create a post with dynamic content:

ts
await Trotsky.init(agent)
  .createPost(() => ({
    text: `Current time: ${new Date().toLocaleTimeString()}`
  }))
  .run()

Example 3

Schedule recurring posts:

ts
Trotsky.init(agent)
  .createPost(() => ({
    text: `Good morning! ${new Date().toDateString()}`
  }))
  .schedule('0 9 * * *') // Every day at 9 AM

Constructors

Constructor

Modifiers

Description

(constructor)(agent, parent, record)

Initializes the create-post step with the provided agent, parent, and record parameters.

Properties

Property

Modifiers

Type

Description

_record

ResolvableStepCreatePostParams

Stores the parameters needed to create a post, which may be resolved at runtime.

Methods

Method

Modifiers

Description

apply()

Executes the create-post step by sending a request to the Bluesky service and assigning the returned URI and CID to this.output.

clone(rest)

Clones the current step and returns a new instance with the same parameters.

queryParams()

Resolves the post creation parameters from a potentially dynamic input source.