Analyze Bluesky activity

What happened in a community activity window: organic conversations, reaction bursts, or automated bot traffic?

In this guide, you run a Go collector that subscribes to the public Bluesky Jetstream firehose and appends arriving JSON events into ScopeDB through the Go SDK. While the live stream accumulates in the background, you first verify your analytical queries against a deterministic 16-event sample (capture_id = 'first') where every count is known (six new posts, including two replies, and five like or repost creations), then run the same ScopeQL pipelines against the live firehose (capture_id = 'live-first') to chart event volume, profile high-frequency actors directly from nested JSON fields, and compare capture windows without double-counting replayed batches.

Allow about 15 minutes after workspace setup.

1. Get the collector and connect

You need a ready ScopeDB Cloud workspace, Go 1.26 or later, Git, and a terminal (macOS, Linux, or WSL). Use a test workspace: this guide creates guide_bluesky.events_raw and the guide_bluesky.events view in the default scopedb database.

Clone the Demo Scene repository and enter the bluesky-events directory, which contains the collector, the 16-event sample (sample.ndjson), saved queries, and tests:

git clone https://github.com/scopedb/demo-scene.git scopedb-demos
cd scopedb-demos/bluesky-events
go mod download

Keep this terminal open. In Console, open Home in your workspace and copy ScopeDB API.

Light-mode Console Home page for Northstar Analytics, showing the workspace connection bar with the example API address ap-southeast-1.aws.scopedb.cloud and Create API key.
Copy the ScopeDB API address from your own workspace, then choose Create API key. The account and address shown are demonstration values.
Light-mode Console Home page for Northstar Analytics, showing the workspace connection bar with the example API address ap-southeast-1.aws.scopedb.cloud and Create API key.
Copy the ScopeDB API address from your own workspace, then choose Create API key. The account and address shown are demonstration values.

Choose Create API key, give it a name such as event-tutorial, and choose an expiration. Select Create Key and copy the one-time secret. You can follow the connection walkthrough for additional setup details.

Light-mode Create API Key dialog with the name event-tutorial and a 90-day expiration.
Give the key a recognizable name, choose an expiration, and select Create Key. Save the secret when it appears.
Light-mode Create API Key dialog with the name event-tutorial and a 90-day expiration.
Give the key a recognizable name, choose an expiration, and select Create Key. Save the secret when it appears.

Export the endpoint and API key in your terminal:

export SCOPEDB_ENDPOINT="https://<endpoint>"
export SCOPEDB_API_KEY="<api-key>"

Keep credentials in your local environment, outside source control. The live collector reads from the public Bluesky Jetstream service without requiring a Bluesky account or token, and the fixed sample remains available offline.

2. Create the schema and start the collector

The collector writes promoted envelope columns (capture_id, event_id, event_time, ingested_at, collection, operation) alongside the complete upstream payload in a single raw object column. Create the guide_bluesky schema, the append-only events_raw table, and the deduplicated events view using scope catalog (or in Console Data):

scope catalog apply --schema scopedb.guide_bluesky -f - --yes <<'JSON'
{
  "name": "guide_bluesky",
  "tables": [
    {
      "name": "events_raw",
      "columns": [
        { "name": "capture_id", "data_type": "string" },
        { "name": "event_id", "data_type": "string" },
        { "name": "event_time", "data_type": "timestamp" },
        { "name": "ingested_at", "data_type": "timestamp" },
        { "name": "collection", "data_type": "string" },
        { "name": "operation", "data_type": "string" },
        { "name": "raw", "data_type": "object" }
      ]
    }
  ],
  "views": [
    {
      "name": "events",
      "statement": "FROM guide_bluesky.events_raw DISTINCT ON capture_id, event_id BY ingested_at DESC"
    }
  ]
}
JSON

events_raw retains every imported delivery, while events selects the latest delivery of each (capture_id, event_id) pair by ingested_at DESC. Query guide_bluesky.events for all downstream analysis so that replaying a file or recovering an interrupted batch never inflates your counts.

Start the collector and leave this terminal running while you work in Console:

go run .

On startup, the program ensures the 16-event constructed sample is loaded under capture_id = 'first', then connects to Jetstream and continuously appends live events under capture_id = 'live-first' (flushing every 500 events or at least once per second). Press Ctrl+C whenever you want to stop; the collector flushes its active buffer before exiting.

Verify the deterministic sample window in Console Query:

FROM guide_bluesky.events
WHERE capture_id = 'first'
AGGREGATE count() AS unique_events,
    min(event_time) AS first_seen, max(event_time) AS last_seen
unique_eventsfirst_seenlast_seen
162026-10-01T09:00:00Z2026-10-01T09:00:15Z

3. Calibrate the queries on the fixed sample

Before querying a moving firehose, verify how each query separates record creations, nested reply metadata, and reaction targets on the 16-event sample.

First, count new record creations by collection:

FROM guide_bluesky.events
WHERE capture_id = 'first' AND operation = 'create'
GROUP BY collection
AGGREGATE count() AS creates
ORDER BY creates DESC, collection
collectioncreates
app.bsky.feed.post6
app.bsky.feed.like3
app.bsky.feed.repost2
app.bsky.graph.follow2

Filtering to operation = 'create' excludes the sample's remaining three mutations (one post update and two deletes) so edits and deletions are not miscounted as new posts.

Next, inspect the six post creations by traversing directly into the semi-structured raw object column—checking raw['record']['reply'] to distinguish replies from top-level posts, and TRY(raw['record']['embed']['$type']::string) to extract the attached media type without failing when embed is absent:

FROM guide_bluesky.events
WHERE capture_id = 'first'
    AND collection = 'app.bsky.feed.post' AND operation = 'create'
SELECT raw['record']['reply'] IS NOT NULL AS is_reply,
    TRY(raw['record']['embed']['$type']::string) AS embed_type
GROUP BY is_reply, embed_type
AGGREGATE count() AS posts
ORDER BY posts DESC, is_reply, embed_type
is_replyembed_typeposts
FALSENULL2
FALSEapp.bsky.embed.external1
FALSEapp.bsky.embed.images1
TRUEapp.bsky.embed.images1
TRUEapp.bsky.embed.video1

Two of the six new posts are replies (is_reply = TRUE), and four of the six carry an image, external link, or video embed.

4. Join reactions to captured posts and inspect raw payloads

Dividing three likes by six posts does not produce a true engagement rate: reactions in an event stream often target posts created hours or days before your capture window opened. To check how many reactions reference posts created within the same capture, reconstruct each post's AT URI (at://<did>/<collection>/<rkey>) from raw and LEFT JOIN reaction targets against observed post creations:

FROM guide_bluesky.events
WHERE capture_id = 'first' AND operation = 'create'
    AND collection IN ('app.bsky.feed.like', 'app.bsky.feed.repost')
SELECT collection, TRY(raw['record']['subject']['uri']::string) AS target_uri
LEFT JOIN (
    FROM guide_bluesky.events
    WHERE capture_id = 'first'
        AND collection = 'app.bsky.feed.post' AND operation = 'create'
    SELECT 'at://' || raw['did']::string || '/' || collection
        || '/' || raw['rkey']::string AS post_uri
    DISTINCT ON post_uri
) AS posts ON target_uri = posts.post_uri
GROUP BY collection
AGGREGATE count() AS interactions,
    sum(if(posts.post_uri IS NOT NULL, 1, 0)) AS targets_observed,
    sum(if(posts.post_uri IS NULL, 1, 0)) AS targets_not_observed
ORDER BY collection
collectioninteractionstargets_observedtargets_not_observed
app.bsky.feed.like321
app.bsky.feed.repost211

Three of the five reactions match posts created inside the first window; the other two target older or external posts.

To inspect the underlying JSON document for any post mutation in Console, select the raw column:

FROM guide_bluesky.events
WHERE capture_id = 'first' AND collection = 'app.bsky.feed.post'
SELECT event_time, operation, raw
ORDER BY event_time

Click the raw cell in row 4 (2026-10-01T09:00:03Z) to open Row details. The side panel formats the complete semi-structured object so you can inspect nested paths such as raw['record']['text'] ("A constructed reply.") and raw['record']['reply'] before promoting or filtering on them in ScopeQL.

Light-mode Console Query view showing the 8 post mutations in capture first and the Row details drawer open on row 4, displaying the formatted raw JSON object including record.text and record.reply.
Click any raw cell to open Row details and inspect nested fields such as record.text and record.reply directly alongside the query results.
Light-mode Console Query view showing the 8 post mutations in capture first and the Row details drawer open on row 4, displaying the formatted raw JSON object including record.text and record.reply.
Click any raw cell to open Row details and inspect nested fields such as record.text and record.reply directly alongside the query results.

5. Investigate live Bluesky traffic

While you calibrated the queries on first, the collector has been continuously streaming public Bluesky activity into capture_id = 'live-first'. Because ScopeDB evaluates path expressions directly on the raw object column alongside promoted tags, you can pivot from high-level volume charts to ad-hoc actor profiling without altering the table schema.

Chart the live event mix

Start by breaking down all captured live deliveries by shortened collection and operation:

FROM guide_bluesky.events
WHERE capture_id = 'live-first'
SELECT replace(collection, 'app.bsky.', '') || ' · ' || operation AS event_type
GROUP BY event_type
AGGREGATE count() AS events
ORDER BY events DESC, event_type

Switch the results toolbar from Table to Chart (Bar) to visualize the distribution across event types. In a typical multi-minute capture (344,603 events in the example below), feed.like · create dominates volume (223,061), followed by feed.post · create (51,831), feed.repost · create (35,300), and graph.follow · create (20,768), while delete operations form a long tail of unlikes, unfollows, and post removals.

Light-mode Console Chart view displaying a bar chart of live-first events by collection and operation, led by feed.like create above 220K events, followed by feed.post create, feed.repost create, and graph.follow create.
Switch to Chart view to compare event volume across collections and operations. Likes and posts lead creation volume, while delete events capture unlikes, unfollows, and post removals.
Light-mode Console Chart view displaying a bar chart of live-first events by collection and operation, led by feed.like create above 220K events, followed by feed.post create, feed.repost create, and graph.follow create.
Switch to Chart view to compare event volume across collections and operations. Likes and posts lead creation volume, while delete events capture unlikes, unfollows, and post removals.

Profile high-frequency actors and bots via ad-hoc JSON paths

Even though did (the decentralized account identifier) was never extracted into a dedicated table column, you can group directly by raw['did']::string and use ScopeQL's pipelined SELECT ... GROUP BY ... AGGREGATE flow to inspect the behavior of the most active accounts in live-first:

FROM guide_bluesky.events
WHERE capture_id = 'live-first' AND raw['did'] IS NOT NULL
SELECT replace(collection, 'app.bsky.', '') || '.' || operation AS kind, raw['did']::string AS did
GROUP BY did
AGGREGATE count() AS events,
    sum(if(kind = 'graph.follow.create', 1, 0)) AS follows,
    sum(if(kind = 'feed.like.create', 1, 0)) AS likes,
    sum(if(kind = 'feed.post.create', 1, 0)) AS posts,
    sum(if(kind = 'graph.follow.delete', 1, 0)) AS unfollows
ORDER BY events DESC LIMIT 5
Light-mode Console Table view showing the top 5 most active DIDs in live-first, with column histograms and per-actor counts for events, follows, likes, posts, and unfollows.
Grouping directly by raw['did']::string reveals distinct automation signatures at the top of the firehose: dedicated follow bots (1,619 follows, 0 other actions), like bots (1,295 likes), high-volume posters (748 posts), and mass-unfollow accounts (600 unfollows).
Light-mode Console Table view showing the top 5 most active DIDs in live-first, with column histograms and per-actor counts for events, follows, likes, posts, and unfollows.
Grouping directly by raw['did']::string reveals distinct automation signatures at the top of the firehose: dedicated follow bots (1,619 follows, 0 other actions), like bots (1,295 likes), high-volume posters (748 posts), and mass-unfollow accounts (600 unfollows).

Breaking each actor's total volume into follows, likes, posts, and unfollows immediately exposes automated behavior in the live stream—such as accounts that emit exclusively graph.follow.create (1,619 follows and zero posts or likes) or exclusively graph.follow.delete (600 unfollows).

Compare two live capture windows

To compare activity across separate observation windows, press Ctrl+C in the collector terminal and start a second live capture with -capture-id live-second:

go run . -capture-id live-second

Earlier captures remain intact. Run the following query to compare the observation boundaries, new post volume, and reply share between live-first and live-second:

FROM guide_bluesky.events
WHERE capture_id IN ('live-first', 'live-second')
    AND collection = 'app.bsky.feed.post' AND operation = 'create'
GROUP BY capture_id
AGGREGATE min(event_time) AS first_seen, max(event_time) AS last_seen,
    count() AS posts,
    sum(if(raw['record']['reply'] IS NOT NULL, 1, 0)) AS replies
SELECT *, round(100.0 * replies / posts, 1) AS reply_percent
ORDER BY capture_id
Light-mode Console Table view comparing live-first and live-second observation boundaries, new post counts (1842 and 1910), reply counts (833 and 825), and rounded reply percentages (45.2 and 43.2).
Compare reply_percent alongside each window's first_seen and last_seen boundaries. Re-run the query at any time to include newly committed batches in the active window.
Light-mode Console Table view comparing live-first and live-second observation boundaries, new post counts (1842 and 1910), reply counts (833 and 825), and rounded reply percentages (45.2 and 43.2).
Compare reply_percent alongside each window's first_seen and last_seen boundaries. Re-run the query at any time to include newly committed batches in the active window.

Always evaluate posts and reply_percent alongside first_seen and last_seen so differences in capture duration are not mistaken for changes in posting rate.

6. Verify idempotent replay and delivery semantics

In production ingestion pipelines, network interruptions or client retries can deliver the same batch more than once. To see how the guide_bluesky.events view protects your queries from duplicate deliveries, replay sample.ndjson into capture_id = 'first':

go run . load -file sample.ndjson -capture-id first

Then compare the row count in the base table (events_raw) against the deduplicated view (events):

FROM guide_bluesky.events_raw
WHERE capture_id = 'first'
AGGREGATE count() AS stored_rows
FROM guide_bluesky.events
WHERE capture_id = 'first'
AGGREGATE count() AS unique_events
TargetCount before replayCount after replayBehavior
guide_bluesky.events_raw1632Appends every delivery so raw ingestion history and audit trails remain intact.
guide_bluesky.events1616Deduplicates on (capture_id, event_id) by ingested_at DESC at query time.

Keep these four ingestion contracts in mind when adapting this pattern to your own streams:

  • Idempotent batch recovery: If an SDK append fails or returns an unknown outcome, the collector stops and writes the unconfirmed batch to a local recovery file instead of blindly retrying. Once you resolve the underlying issue, replay the file under the original capture ID (go run . load -file <recovery-file> -capture-id live-first).
  • Capture-scoped deduplication: event_id combines the Jetstream source instance and sequence number, and events deduplicates within each capture_id. Keep the same capture_id when replaying a recovery file, and avoid summing overlapping capture IDs without deduplicating across event_id.
  • Observation vs. author timestamps: event_time records the relay's observation timestamp (witnessedAt, falling back to time) rather than the client-supplied record.createdAt, which can be clock-skewed or backdated. ingested_at records when the loader processed the event.
  • Append-only mutation log: Creating, updating, and deleting a post are distinct events with distinct sequence numbers. A delete event carries no record body and does not erase earlier create payloads from events_raw.

Continue with Query events to explore more ScopeQL patterns, Model event data to decide when to promote hot JSON paths into typed columns, or Set data retention to manage historical storage.

Troubleshooting

SymptomNext step
Connection unavailableCheck outbound WebSocket access. The producer retries the same source; stop it and use a new capture ID before switching sources.
401 or 403 during writeVerify SCOPEDB_ENDPOINT, SCOPEDB_API_KEY, key expiration, and the target workspace.
Setup query failsRun the setup statements in the workspace matching your API key, then click Refresh catalog if the tree is stale.
Counts do not changeConfirm the collector is still printing Committed ... events, check your capture_id filter, and click Run again.
SDK append failsKeep the printed recovery file path, fix the connectivity or auth issue, and replay with go run . load -file <path> -capture-id <id>.
Sample replay has 32 rowsQuery guide_bluesky.events instead of guide_bluesky.events_raw so duplicate deliveries are collapsed.