Unlisted
Script
Forked from jordan/rss_to_bsky
October 23, 2023
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
export async function post_to_bsky(text, identifier, password) {
const { default: bsky } = await import("npm:@atproto/api");
const { BskyAgent, RichText } = bsky;
const agent = new BskyAgent({ service: "https://bsky.social" });
await agent.login({ identifier, password });
const post = new RichText({ text });
await post.detectFacets(agent);
// todo card & images
// https://github.com/milanmdev/bsky.rss/blob/main/app/utils/bskyHandler.ts#L51
const postRecord = {
$type: "app.bsky.feed.post",
text: post.text,
facets: post.facets,
createdAt: new Date().toISOString(),
};
return await agent.post(postRecord);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023