Skyware Documentation

website·Indexed 29 days ago

https://skyware.js.org/

Developer resources for building on the AT Protocol (ATP), featuring the @skyware/bot library for creating Bluesky bots, Jetstream for event and record management, and a Labeler server implementation for managing signed labels.

Tokens
40K
Snippets
274
Records
393
Agent score
57%

What's inside Skyware

  1. Use FeedGeneratorData to construct a FeedGenerator

    The FeedGeneratorData interface defines the data structure required to construct a FeedGenerator class. It contains identity, profile, and metadata information about the feed generator.
    interface FeedGeneratorData {
      displayName: string;
      uri: string;
      cid: string;
      did: string;
      creator: Profile;
      description?: string;
      descriptionFacets?: Facet[];
      avatar?: string;
      isOnline?: boolean;
      likeUri?: string;
      indexedAt: Date;
    }
  2. Conversation class overview

    The Conversation class represents a DM conversation on Bluesky. It provides access to conversation metadata and methods for interacting with the chat history and participants.
    // Example properties available on a Conversation instance:
    conversation.id;           // string: The conversation's ID
    conversation.muted;         // boolean: Whether the bot account has this conversation muted
    conversation.unreadCount;   // number: The number of unread messages
    conversation.members;       // Profile[]: The users that are members in this conversation
  3. Manage user lists with the List class

    The List class represents a collection of users. It provides access to list metadata (name, URI, CID, purpose) and allows developers to interact with the list's members and their activity feeds.
  4. Understand AT Protocol (atproto) core concepts

    The AT (Authenticated Transfer) Protocol is the underlying technology for Bluesky. It is a decentralized network where users maintain their own data repositories.
  5. Use the ChatMessage class to represent chat messages

    The ChatMessage class (extending BaseChatMessage) represents a message within a chat conversation. It contains the message text, sender information, and optional metadata like facets and embedded references.
  6. Use BotChatEmitter to poll chat logs

    The BotChatEmitter class extends EventEmitter and is responsible for polling a chat log endpoint to emit events. It requires a BotChatEmitterOptions configuration object and an active Bot instance during initialization.
  7. Understand AT Protocol (atproto) core concepts

    The AT (Authenticated Transfer) Protocol is the underlying decentralized technology used by Bluesky. Key architectural components include:

    • PDS (Personal Data Server): Stores and serves a user's repository, handles authentication, and acts as a proxy between clients and other services.
    • Relay (Firehose): Crawls PDSes for new data and outputs a WebSocket stream of network-wide events.
    • AppView: Consumes data from Relays to assemble feeds for users, interpreting specific Lexicons to map data to application features (e.g., mapping a 'like' record to a count).
    • Jetstream: A service that provides a filtered WebSocket stream of events from a Relay based on specific collections of interest.
  8. Use RateLimitedAgent for rate-limited XRPC requests

    The RateLimitedAgent is an XRPC agent designed to handle requests with rate-limiting. It wraps a client and uses a specified rate limit threshold to manage request flow.
    const agent = new RateLimitedAgent(options, limiter);
  9. Use PostSelfLabels to categorize post content

    The PostSelfLabels enum provides a set of labels that can be self-applied when creating a post to warn users about the nature of the media content. Available labels include:

    • GraphicMedia ("graphic-media"): Used when post media contains graphic content.
    • Nudity ("nudity"): Used when post media contains non-sexual nudity.
    • Sexual ("sexual"): Used when post media contains sexual content.
    • Porn ("porn"): Used when post media contains pornographic content.
    enum PostSelfLabels {
      GraphicMedia = "graphic-media",
      Nudity = "nudity",
      Sexual = "sexual",
      Porn = "porn",
    }
  10. Use the StarterPackData interface to construct a StarterPack

    The StarterPackData interface defines the required and optional properties used to instantiate a StarterPack class. It contains metadata about the starter pack, including its identity (URI, CID), ownership (creator), and associated resources (user lists, feeds).
    interface StarterPackData {
      name: string;
      uri: string;
      cid: string;
      description?: string;
      descriptionFacets?: Main[];
      creator: Profile;
      userList?: List;
      userListUri: string;
      feeds?: FeedGenerator[];
      feedUris?: string[];
      joinedWeekCount?: number;
      joinedAllTimeCount?: number;
      indexedAt: Date;
      labels?: Label[];
    }
  11. Understand AT Protocol (atproto) core concepts

    The AT (Authenticated Transfer) Protocol is the underlying decentralized technology used by Bluesky. It enables a network of users to store and share data across various services.
  12. Understand AT Protocol network components

    The network consists of several primary components:

    • PDS (Personal Data Server): Stores and serves a user's repository, handles authentication, and acts as a proxy between clients and other services.
    • Relay (Firehose): Crawls PDSes for new data and outputs a WebSocket stream of events across the network.
    • AppView: Consumes data from Relays to assemble feeds for users, interpreting specific Lexicons (e.g., mapping app.bsky.feed.like to a like count).
    • Jetstream: A service providing a filtered WebSocket stream of events based on specific collections.