Skip to main content

Thread gates

Thread gates set who can reply to a post.

The available rules are:

  • app.bsky.feed.threadgate#mentionRule: Allow replies from actors mentioned in your post.
  • app.bsky.feed.threadgate#followingRule: Allow replies from actors you follow.
  • app.bsky.feed.threadgate#followerRule: Allow replies from actors following you.
  • app.bsky.feed.threadgate#listRule: Allow replies from actors on a list.

A thread gate may have up to 5 rules.

Setting a thread gate

You set a thread gate by creating a app.bsky.feed.threadgate record with the same rkey as the post you're gating.

import { currentDatetimeString } from '@atproto/lex'
import { AtUri } from '@atproto/syntax'
import { app } from '@bsky/sdk/lexicons'

const {rkey} = new AtUri(postUri)

await client.create(app.bsky.feed.threadgate, {
post: postUri,
allow: [
// allow mentioned users
{$type: 'app.bsky.feed.threadgate#mentionRule'},
// allow followed users
{$type: 'app.bsky.feed.threadgate#followingRule'},
// allow list members
{$type: 'app.bsky.feed.threadgate#listRule', list: listUri},
],
createdAt: currentDatetimeString()
}, { rkey })

If a thread gate record is present but empty, then nobody can reply.

await client.create(app.bsky.feed.threadgate, {
post: postUri,
// empty allow-list, nobody can reply
allow: [],
createdAt: currentDatetimeString()
}, { rkey })

If a thread gate record is not present, then anybody can reply.


Looking for more? Browse additional tutorials and guides on atproto.com.