Runs every 1 hrs
Fork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const runner = (async () => {
const ALERT_STRINGS = [
"buttondown",
"buttondown.email",
];
// Let's not email ourselves when we post..
const USERNAME_DENYLIST = [
"buttondown.bsky.social",
];
const promises = ALERT_STRINGS.map(async function (keyword) {
let posts = await @stevekrouse.fetchJSON(
`https://search.bsky.social/search/posts?q=${keyword}`,
);
let newPosts = posts.filter((post) =>
!@buttondown.encounteredIDs.includes(post.tid) &&
!USERNAME_DENYLIST.includes(post.user.handle)
);
newPosts.map((post) => {
@buttondown.encounteredIDs.push(post.tid);
});
newPosts.map((post) => {
console.log(post);
console.email({
html: `https://bsky.app/profile/${post.user.handle}/post/${
post.tid.split("/")[1]
}`,
subject: `New post in Bluesky for ${keyword}`,
});
});
});
await Promise.all(promises);
});
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.
Comments
stevekrouse avatar

Awesome! Been meaning to have this for val town!

Forked: https://www.val.town/v/stevekrouse.blueskyAlert