The current en vogue alternative for Twitter is the invite-only services Bluesky. Based on the open specifications of the foundational concept, the AT Protocol, and the available API client on GitHub, it is not that complex to retrieve details of one of your posts; for example the number of likes.
Preparations
Obviously, you need to have an user account for Bluesky to use the API. Try to use bsky-social-blymn-z5zoq
, bsky-social-d6mzh-y7237
, or bsky-social-ppfho-gp5dr
as invite codes.
Needed API Parameters
For a Bluesky post, the URL schema includes an user
identifier and a post
identifier. The existing post available at https://bsky.app/profile/sbstjn.com/post/3kb6fwckykw2o
references the user sbstjn.com
and 3kb6fwckykw2o
as the post identifier.
Together with a valid user password, you can use the official Bluesky API client in TypeScript to retrieve the details of this post. Of course, fist install the package:
# Install dependencies
$ > yarn add @atproto/api
Next, you can retrieve a user’s Decentralized ID to get the post details:
// File main.ts using Bluesky API client
import { BskyAgent } from '@atproto/api';
const identifier = process.env.BS_USER!
const password = process.env.BS_PASSWORD!
const post = process.env.BS_POST!
const collection = 'app.bsky.feed.post'
const agent = new BskyAgent({ service: 'https://bsky.social' })
const main = async () => {
const user = await agent.login({ identifier, password });
const uris = [
`at://${user.data.did}/${collection}/${post}`
]
const posts = await agent.getPosts({ uris })
console.log(`${posts.data.posts.shift()?.likeCount} like(s)`)
}
main().then()
The script requires three environment variables: BS_POST
, BS_USER
, and BS_PASSWORD
:
# Get like count for a Bluesky post
$ > BS_POST=3kf3u5ldu6j2e \
BS_USER=sbstjn.com \
BS_PASSWORD=YOUR_SECRET_PASSWORD \
npx ts-node main.ts
2 like(s)
That’s it. In addition to the mentioned three invite codes in the beginning, you can also try using bsky-social-mv3c5-puvxd
and bsky-social-6avqe-6vgea
to create a Bluesky account.
-
December 18 th, 2023
860 Words
I am a huge fan of Computer Interfaces; especially non-textual ones. Spoken words can be a powerful interface to digital services; Amazon Web Services has various services and products available that work with audio. To identify language in spoken words and extract textual information, you can use Amazon Transcribe and analize audio files.
-
December 10 th, 2023
1117 Words
The weekend was nice; I had some fun using the bunq API and configure webhooks for account activities and explained how to use Amazon EventBridge Pipes to process and transform messages from SQS. Now, it’s time to combine both and get bunq events to Amazon EventBridge!
-
December 10 th, 2023
367 Words
When managing continuous events, Amazon EventBridge is a powerful and fully managed service. With Amazon EventBridge Pipes it’s easy to organize, structure, and transform incoming data messages. Using the AWS Cloud Development Kit, this guide will configure an Amazon SQS Queue and use Amazon EventBridge Pipes for data processing and transformation.
-
December 9 th, 2023
1505 Words
The digital banking service bunq has an API for their banking accounts. With support for webhooks, you can easily track any activity within your account! bunq calls them Callbacks. This guide explains how to use the bunq mobile application and some cURL requests to get a JSON request for every activity in your bunq banking accounts.
-
December 3 rd, 2023
369 Words
AWS Step Functions can easily be used to wrap existing AWS services and persist specific use cases. For example, AWS Step Functions can call the Amazon Bedrock API to generate text responses using the AI21 Labs Jurassic-2 models. You can create a Step Function using the AWS Management Console, or the AWS Cloud Development Kit.
-
October 31 st, 2023
535 Words
The previous post described how to create an Amazon EventBridge Event Bus with Amazon CloudWatch Log forwarding using the AWS CDK. Publishing events works fine with the AWS Management Console or the AWS CLI, but you can also use Service Integrations for Amazon API Gateway; this works for HTTP and Rest API Gateways.
-
October 31 st, 2023
583 Words
Amazon EventBridge is a powerful service to build event-driven applications at scale across AWS. To get started with EventBridge, you just need to create an Event Bus; for example, using the AWS Cloud Development Kit. Next, forwarding all events to an Amazon CloudWatch Log group enables basic insights into all processed events.