Created
May 31, 2024 18:49
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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