Vals using @atproto/api
Description from the NPM package:
Client library for atproto and Bluesky
panphora
bsky_phrase_tracker
Cron
Bluesky Phrase Tracker Track topics, communities, and conversations on Bluesky by monitoring specific phrases and getting email notifications when they appear in new posts. Features Monitor multiple phrases or terms simultaneously Get email notifications for new matching posts Customizable search intervals Exact phrase matching to reduce false positives Rate limiting protection Error notifications if something goes wrong Prerequisites To use this tracker, you'll need: A Bluesky account A Val Town account to host and run the script Environment variables set up for your Bluesky credentials Setup Instructions Create a new Val in Val Town and paste the code from this repository Set up your environment variables in Val Town: BSKY_USER : Your Bluesky email/handle BSKY_PASS : Your Bluesky app password (create one in Bluesky settings) Customize the TRACKED_PHRASES array with your own phrases to monitor: const TRACKED_PHRASES = [
"your phrase 1",
"your phrase 2",
"your community name",
// add more phrases as needed
]; Set up the interval for how often you want the tracker to run using Val Town's scheduling feature. How It Works The tracker: Logs into your Bluesky account Searches for each tracked phrase Filters results for exact matches Compiles matching posts into an email Sends you a notification with links to the posts If any errors occur (like login failures), you'll receive an error notification email. Customization Tips Adjust the search interval based on your needs Modify the email template in the code to change the notification format Add additional filters for the posts you want to track Customize the delay between searches to adjust rate limiting Troubleshooting If you're not receiving notifications: Check your environment variables are set correctly Verify your Bluesky credentials Ensure your email address is configured in Val Town Check the Val Town logs for any error messages Contributing Feel free to fork this code and adapt it for your own needs. If you make improvements, consider sharing them back with the community! Credits Built using: atproto/api for Bluesky integration Val Town for hosting and scheduling
0
jonasmerlin
bluesky_bot_template
Cron
This is a very simple template for the kind of Bluesky bot I build. It's very much all over the place. e.g. it sets up the "Agent" to post (because that part is documented well), but doesn't use it to search for posts. You can do that if you want (if you do, look here ), but I like to simply rawdogg the API, so that is what I'm doing here.
The custom Post type is incomplete and only contains the stuff I found relevant.
Error handling is payed only lip service to (at best) as well. ...But it works for me! How to use If you want to use this, you will have to set 2 environment variables for your val:
BLUESKY_USERNAME
BLUESKY_PASSWORD
From what I can tell from my testing: BLUESKY_USERNAME can be both the bot account's handle as well as the email you use to log into it with. BLUESKY_PASSWORD can be both the account's main password as well as an app password. The rest is commented in the code. If you have any questions, feel free to message me on Bluesky: Jonas-Merlin Schumacher (@jonasmerlin.bsky.social) — Bluesky
2

stevekrouse
blueskySearchPostsDemo
Script
app.bsky.feed.searchPosts API Docs: https://docs.bsky.app/docs/api/app-bsky-feed-search-posts Example Response XRPCResponse {
data: {
posts: [
{
uri: "at://did:plc:uqtqvy3ydp2pcqbgr2yjppcj/app.bsky.feed.post/3lbsfypbbdk26",
cid: "bafyreiesbymbxclbatvh3slqmmrbazkupng4kcwn5tojnojvvrb3pzock4",
author: {
did: "did:plc:uqtqvy3ydp2pcqbgr2yjppcj",
handle: "kyrre.dev",
displayName: "Kyrre",
avatar: "https://cdn.bsky.app/img/avatar/plain/did:plc:uqtqvy3ydp2pcqbgr2yjppcj/bafkreiadk656yzrvkpgr5avgcab6ftmptig4slqyn3hturou3eaox5o24i@jpeg",
labels: [],
createdAt: "2023-11-26T00:05:04.154Z"
},
record: {
"$type": "app.bsky.feed.post",
createdAt: "2024-11-25T20:58:07.518Z",
facets: [Array],
langs: [Array],
reply: [Object],
text: "Cool, @val.town is awesome!"
},
replyCount: 0,
repostCount: 0,
likeCount: 2,
quoteCount: 0,
indexedAt: "2024-11-25T20:58:07.955Z",
labels: []
},
{
uri: "at://did:plc:4op2gckllrrttktwi4vg2j2p/app.bsky.feed.post/3lbs6qjce6k2c",
cid: "bafyreicx6nivr22zdpuxvnihfk3ifk3d6y37ug5e32tqzkcefmwnxsqt6a",
author: {
did: "did:plc:4op2gckllrrttktwi4vg2j2p",
handle: "gksh.dev",
displayName: "Gustavo Karkow",
avatar: "https://cdn.bsky.app/img/avatar/plain/did:plc:4op2gckllrrttktwi4vg2j2p/bafkreib5m52xjyidrsnfvyxoie7zwpusus6wzacr4k2tpobue5o7ysr3o4@jpeg",
associated: [Object],
labels: [],
createdAt: "2023-07-28T21:31:46.738Z"
},
record: {
"$type": "app.bsky.feed.post",
createdAt: "2024-11-25T18:48:16.611Z",
embed: [Object],
facets: [Array],
langs: [Array],
text: "@stevekrouse.com can't tell what happened, but I was using Townie for a thing and it inverted the reasoning and code outputs for whatever reason."
},
embed: { "$type": "app.bsky.embed.images#view", images: [Array] },
replyCount: 1,
repostCount: 0,
likeCount: 1,
quoteCount: 0,
indexedAt: "2024-11-25T18:48:19.130Z",
labels: []
},
{
uri: "at://did:plc:hkutgcisjksjzjl7j2xwjbsw/app.bsky.feed.post/3lbrrmgknxs2f",
cid: "bafyreiesuxytdmwqb27tw32r6hrmcvq6up7xffs27mxmayfjph3yvsehmi",
author: {
did: "did:plc:hkutgcisjksjzjl7j2xwjbsw",
handle: "bezbac.me",
displayName: "Ben Bachem",
avatar: "https://cdn.bsky.app/img/avatar/plain/did:plc:hkutgcisjksjzjl7j2xwjbsw/bafkreienzxwrlwwocthenmzs57xptthtvahgjbh7k4qg47mvpvx2lapdfu@jpeg",
associated: [Object],
labels: [],
createdAt: "2023-08-29T19:30:57.132Z"
},
record: {
"$type": "app.bsky.feed.post",
createdAt: "2024-11-25T14:53:20.897Z",
facets: [Array],
langs: [Array],
reply: [Object],
text: "Congrats! I’m always impressed by product and team at @val.town"
},
replyCount: 0,
repostCount: 0,
likeCount: 2,
quoteCount: 0,
indexedAt: "2024-11-25T14:53:21.757Z",
labels: []
},
{
uri: "at://did:plc:zxkg5d6y6uhrsoctq7wgwqul/app.bsky.feed.post/3lbrrjwuz422q",
cid: "bafyreic7m5lf4ta5az2hwcaa7hzka6dawadsohiqxyikmeb7ql4k3q3bwq",
author: {
did: "did:plc:zxkg5d6y6uhrsoctq7wgwqul",
handle: "just-be.dev",
displayName: "Justin",
avatar: "https://cdn.bsky.app/img/avatar/plain/did:plc:zxkg5d6y6uhrsoctq7wgwqul/bafkreidbly6rg5tzb3pnlizsxevgd3nvu42ko4r6igetudvwvp2qnbx2fa@jpeg",
labels: [],
createdAt: "2023-04-24T14:47:37.014Z"
},
record: {
"$type": "app.bsky.feed.post",
createdAt: "2024-11-25T14:51:57.352Z",
facets: [Array],
langs: [Array],
text: "Hey friends! Big news. I'm working at @val.town now!"
},
replyCount: 16,
repostCount: 4,
likeCount: 72,
quoteCount: 0,
indexedAt: "2024-11-25T14:51:57.665Z",
labels: []
},
{
uri: "at://did:plc:jfbrs3p2mytb4qh4kgzdnild/app.bsky.feed.post/3lbprmrkbo22q",
cid: "bafyreieoufjenhjflt2n4lr6k45wys7j3f6nfehs5ndkbs6g2ng2cw7al4",
author: {
did: "did:plc:jfbrs3p2mytb4qh4kgzdnild",
handle: "daniel-levine.bsky.social",
displayName: "Dan Levine",
avatar: "https://cdn.bsky.app/img/avatar/plain/did:plc:jfbrs3p2mytb4qh4kgzdnild/bafkreibjeo2eqdinlrfm6xa2mprnyyaryb3gaajrmhslx5bq2o3xx2ftby@jpeg",
labels: [],
createdAt: "2024-11-04T19:07:59.180Z"
},
record: {
"$type": "app.bsky.feed.post",
createdAt: "2024-11-24T19:48:12.943Z",
embed: [Object],
facets: [Array],
langs: [Array],
reply: [Object],
text: "💯 I want to see a ton of Val.town apps that make use of Bluesky :) cc @stevekrouse.com"
},
embed: { "$type": "app.bsky.embed.external#view", external: [Object] },
replyCount: 1,
repostCount: 0,
likeCount: 1,
quoteCount: 0,
indexedAt: "2024-11-24T19:48:16.162Z",
labels: []
}
]
},
headers: {
"access-control-allow-origin": "*",
"atproto-content-labelers": "did:plc:ar7c4by46qjdydhdevvrndac;redact",
"cache-control": "public, max-age=30",
"cdn-cache": "MISS",
"cdn-cachedat": "11/25/2024 21:38:59",
"cdn-edgestorageid": "894",
"cdn-proxyver": "1.06",
"cdn-pullzone": "1816608",
"cdn-requestcountrycode": "US",
"cdn-requestid": "a5715b0e4a5fa58d0ce748a59a8a66aa",
"cdn-requestpullcode": "200",
"cdn-requestpullsuccess": "True",
"cdn-requesttime": "0",
"cdn-status": "200",
"cdn-uid": "57ad37ea-0c96-40cb-9722-d1abe3b3ecd9",
"content-type": "application/json; charset=utf-8",
date: "Mon, 25 Nov 2024 21:38:59 GMT",
server: "BunnyCDN-IL1-1206",
"strict-transport-security": "max-age=63072000",
vary: "Accept-Encoding",
"x-powered-by": "Express"
},
success: true
}
0