Following, muting, and blocking
Following, muting, and blocking are the basic social graph actions on Bluesky. Following subscribes you to someone's posts, while muting and blocking both let you limit your exposure to another user, in different ways: muting quietly hides someone's posts from your feeds, while blocking prevents interaction in both directions.
Following
- TypeScript
- Python
- Go
Following a user is as easy as calling the follow action with the DID of the user you want to follow.
import { follow } from '@bsky/sdk'
const { uri } = await client.call(follow, { did })
Following a user is as easy as calling client.follow with the DID of the user you want to follow.
uri = client.follow(did).uri
The Go SDK has no dedicated helper; create an app.bsky.graph.follow record whose subject is the DID you want to follow.
follow := &appbsky.GraphFollow{
CreatedAt: time.Now().UTC().Format(time.RFC3339),
Subject: did,
}
resp, _ := comatproto.RepoCreateRecord(ctx, client, &comatproto.RepoCreateRecord_Input{
Repo: client.AccountDID.String(),
Collection: "app.bsky.graph.follow",
Record: &lexutil.LexiconTypeDecoder{Val: follow},
})
| Parameter | Type | Description | Required |
|---|---|---|---|
did | string | The DID of the user to follow | Yes |
Unfollowing
Unfollowing a user involves deleting the follow record via its URI, returned when you created the follow. This is very similar to what we did when unliking a post.
- TypeScript
- Python
- Go
import { deleteFollow } from '@bsky/sdk'
await client.call(deleteFollow, uri)
client.delete_follow(uri)
import "strings"
rkey := uri[strings.LastIndex(uri, "/")+1:]
comatproto.RepoDeleteRecord(ctx, client, &comatproto.RepoDeleteRecord_Input{
Repo: client.AccountDID.String(),
Collection: "app.bsky.graph.follow",
Rkey: rkey,
})
| Parameter | Type | Description | Required |
|---|---|---|---|
uri | string | The URI of the follow record to delete | Yes |
Muting
Muting a user hides their posts from your feeds. Mutes are private — like Bookmarks, they are stored in the Bluesky App, rather than in your PDS. Muting a user is as easy as liking a post or following a user.
- TypeScript
- Python
- Go
import { muteActor } from '@bsky/sdk'
await client.call(muteActor, { actor: did })
client.mute(did)
appbsky.GraphMuteActor(ctx, client, &appbsky.GraphMuteActor_Input{Actor: did})
| Parameter | Type | Description | Required |
|---|---|---|---|
did | string | The DID of the user to mute | Yes |
Unmuting a user
Easy peasy:
- TypeScript
- Python
- Go
import { unmuteActor } from '@bsky/sdk'
await client.call(unmuteActor, { actor: did })
client.unmute(did)
appbsky.GraphUnmuteActor(ctx, client, &appbsky.GraphUnmuteActor_Input{Actor: did})
| Parameter | Type | Description | Required |
|---|---|---|---|
did | string | The DID of the user to un-mute | Yes |
Blocking
Blocking a user prevents interaction and hides the user from the client experience. Blocked accounts will not be able to like, reply, mention, or follow you. Their posts, replies, and profile in search will also be hidden from you. Blocks are public.
Blocking users is as simple as muting, but requires creating a record directly.
- TypeScript
- Python
- Go
import { currentDatetimeString } from '@atproto/lex'
import { app } from '@bsky/sdk/lexicons'
const { uri } = await client.create(app.bsky.graph.block, {
subject: blockingUserDid,
createdAt: currentDatetimeString(),
})
block_record = models.AppBskyGraphBlock.Record(
subject=blocked_user_did,
created_at=client.get_current_time_iso()
)
uri = client.app.bsky.graph.block.create(client.me.did, block_record).uri
Create an app.bsky.graph.block record whose subject is the DID to block.
block := &appbsky.GraphBlock{
CreatedAt: time.Now().UTC().Format(time.RFC3339),
Subject: blockingUserDid,
}
resp, _ := comatproto.RepoCreateRecord(ctx, client, &comatproto.RepoCreateRecord_Input{
Repo: client.AccountDID.String(),
Collection: "app.bsky.graph.block",
Record: &lexutil.LexiconTypeDecoder{Val: block},
})
Creating a block takes two pieces of information. First, the repo the record is written to (the TypeScript client fills this in from your session):
| Parameter | Type | Description | Required |
|---|---|---|---|
repo | string | The DID of the authenticated user | Yes |
And the block record itself:
| Parameter | Type | Description | Required |
|---|---|---|---|
subject | string | The DID of the user to block | Yes |
createdAt | string | The current timestamp | Yes |
Unblocking a user
Similar to likes and follows, unblocking a user is as simple as deleting the record.
- TypeScript
- Python
- Go
import { AtUri } from '@atproto/syntax'
const { rkey } = new AtUri(uri)
await client.delete(app.bsky.graph.block, { rkey })
from atproto import AtUri
rkey = AtUri.from_str(uri).rkey
client.app.bsky.graph.block.delete(client.me.did, rkey)
rkey := uri[strings.LastIndex(uri, "/")+1:]
comatproto.RepoDeleteRecord(ctx, client, &comatproto.RepoDeleteRecord_Input{
Repo: client.AccountDID.String(),
Collection: "app.bsky.graph.block",
Rkey: rkey,
})
| Parameter | Type | Description | Required |
|---|---|---|---|
repo | string | The DID of the authenticated user | Yes |
rkey | string | The record key (rkey) of the block record | Yes |