Skip to content

Instantly share code, notes, and snippets.

@boly38
Created May 31, 2024 18:49
Show Gist options
  • Save boly38/275d95f0da14d8d708a14df9e0bb7c4a to your computer and use it in GitHub Desktop.
Save boly38/275d95f0da14d8d708a14df9e0bb7c4a to your computer and use it in GitHub Desktop.
bluesky '@atproto/api' BskyAgent example using API directly : getPreferences - bluesky-social/bsky-docs#152
// for https://github.com/bluesky-social/bsky-docs/issues/152
import process from "node:process";
import {BskyAgent} from '@atproto/api';
const {"BLUESKY_USERNAME": identifier, "BLUESKY_PASSWORD": password} = process.env;// creds from env
const agent = new BskyAgent({"service": "https://api.bsky.social"})
await agent.login({identifier, password});
const response = await agent.api.app.bsky.actor.getPreferences();
const {preferences} = response.data
console.log(`${identifier}'s preferences:\n` + JSON.stringify(preferences, null, 2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment