Skip to content

Document annotations API in SDK reference docs#3368

Open
SimonWoolf wants to merge 4 commits intomainfrom
annotations-get-docs
Open

Document annotations API in SDK reference docs#3368
SimonWoolf wants to merge 4 commits intomainfrom
annotations-get-docs

Conversation

@SimonWoolf
Copy link
Copy Markdown
Member

Summary

  • Adds a Retrieve annotations section to the message annotations doc covering `channel.annotations.get()`, with samples for JS, Node, Java, Swift, and Python, plus a note pointing users to `channel.getMessage()` when they only need the latest summary. Also promotes Annotation message properties to a top-level heading.
  • Adds the previously undocumented annotations API surface to the SDK reference: a `Channel.annotations` property and full `RealtimeAnnotations` / `RestAnnotations` sections (publish, delete, get, subscribe, unsubscribe) on the realtime and rest channels pages.
  • Adds the missing related types to `realtime-sdk/types.mdx`: `Annotation`, `AnnotationAction`, `GetAnnotationsParams` / `ARTAnnotationsQuery`, and the per-language summary entry types (`SummaryClientIdList`, `SummaryClientIdCounts`, `SummaryTotal`, plus the Java `Summary` wrapper). Also fleshes out the `MessageAnnotations.summary` row, which previously just said `Record<String, JsonObject>`.
  • Following the existing convention (single `Message` rather than `OutboundMessage`), uses a single `Annotation` type and notes which fields are server-set.
  • Restricts new content to the languages that actually ship the API today: JS, Node, Java, Swift, Objective-C, Python (verified by grepping each SDK repo).

Test plan

  • Add the `review-app` label and check the rendered output for both `/docs/messages/annotations` and the new sections in the realtime + rest SDK reference channels/types pages.
  • Spot-check that the `Channel.annotations` link on each channels page lands in the new RealtimeAnnotations / RestAnnotations section.
  • Spot-check the type cross-links from channels.mdx → types.mdx (`Annotation`, `GetAnnotationsParams`, `ARTAnnotationsQuery`, summary entry types).

🤖 Generated with Claude Code

@SimonWoolf SimonWoolf requested a review from m-hulbert May 6, 2026 19:39
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b0096307-ee9f-41ac-b782-c482569a6dfa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch annotations-get-docs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the documentation coverage for the message annotations API, adding end-user guidance for retrieving annotations and filling in previously missing SDK reference surface area and related types.

Changes:

  • Adds a Retrieve annotations section to the message annotations guide, including multi-language examples and guidance on when to prefer channel.getMessage().
  • Documents Channel.annotations and the full REST/Realtime annotations API surfaces (publish/delete/get/subscribe/unsubscribe) in the SDK reference channel pages.
  • Adds and expands missing related types in the realtime SDK types reference, including Annotation, AnnotationAction, query params/types, and summary entry types.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/pages/docs/messages/annotations.mdx Adds end-user “Retrieve annotations” guidance and promotes annotation properties to a top-level section.
src/pages/docs/api/rest-sdk/channels.mdx Documents Channel.annotations and introduces RestAnnotations reference section and methods.
src/pages/docs/api/realtime-sdk/channels.mdx Documents Channel.annotations and introduces RealtimeAnnotations reference section and methods (incl. subscribe/unsubscribe).
src/pages/docs/api/realtime-sdk/types.mdx Adds annotation-related types and fleshes out MessageAnnotations.summary typing and summary entry structures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pages/docs/api/realtime-sdk/types.mdx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread src/pages/docs/messages/annotations.mdx Outdated
Comment thread src/pages/docs/api/realtime-sdk/types.mdx Outdated
@sacOO7
Copy link
Copy Markdown
Contributor

sacOO7 commented May 8, 2026

@sacOO7 sacOO7 self-requested a review May 8, 2026 03:59
@sacOO7 sacOO7 added the review-app Create a Heroku review app label May 8, 2026
@ably-ci ably-ci temporarily deployed to ably-docs-annotations-g-nzmo0d May 8, 2026 04:03 Inactive
@sacOO7
Copy link
Copy Markdown
Contributor

sacOO7 commented May 8, 2026

@claude review

Comment on lines +806 to +807
<Aside data-type='note'>
You should only use this method if you need the full list of individual, raw annotations. If you only need the latest [annotation summary](#annotation-summaries) for a message — for example on a channel you are not subscribed to, where you are not receiving `message.summary` updates — use [`channel.getMessage()`](/docs/messages/updates-deletes#get) instead. The returned message contains the up-to-date `annotations.summary`.
Copy link
Copy Markdown
Contributor

@sacOO7 sacOO7 May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployed current branch preview at https://ably-docs-annotations-g-nzmo0d.herokuapp.com/docs/messages/annotations with username/password = preview.

This seems like a really short note to retrieve annotation summary for given message/message-serial.

As a third person going through the docs, I understand following

Annotations as a feature is defined by the summary =>

  • The five aggregation methods (total.v1, flag.v1, distinct.v1, unique.v1, multiple.v1) all exist to produce different shapes of summary. 
  • Since, summary is a user-facing output, we should explicitly mention ways to retrieve it.
  • IMHO, a dedicated section to retrieve individual annotations using channel.annotations.get with examples provides a very limited use-case value. Also, same events can already be consumed in real time via annotations.subscribe.

Keeping channel.annotations.get section is fine, but a section focused on retrieving summaries under channel.subscribe with relevant examples would provide significantly more value to readers/LLMs.

So, a new Retrieve annotation summary section can be added with examples using channel.getMessage and channel.history -> Internal slack link - ways to retrieve summary

Copy link
Copy Markdown
Contributor

@sacOO7 sacOO7 May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other changes look good

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a section focused on retrieving summaries under channel.subscribe with relevant examples would provide significantly more value

This already exists, it's the section entitled "Subscribe to annotation summaries".

Copy link
Copy Markdown
Contributor

@sacOO7 sacOO7 May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above mentioned link Internal slack link - ways to retrieve summary, Currently, 3 ways to show summaries

1. Live: subscribe to the channel message listener; the server pushes `MESSAGE_SUMMARY` actions.
2. Per-message latest: `channel.getMessage(serial).annotations.summary`.
3. Bulk historical: `channel.history()`; each `Message` already carries `annotations.summary`.

We missing section for 2nd and 3rd one, they are specific to Retrieve annotation summary rather than Subscribe to annotation summaries.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree that annotations.summary being a field on a message means that the annotation docs should have individual sections documenting every api we have that is capable of retrieving messages . Those apis have their own docs pages: once a user knows that the annotation summary is part of the message, they can use that knowledge together with other parts of our documentation; the annotations page need not stand in isolation.

But I am happy to add a short paragraph mentioning those two apis to document that both they will indeed give you the latest version of the summary.

SimonWoolf and others added 4 commits May 8, 2026 17:32
Adds a new "Retrieve annotations" section covering channel.annotations.get()
with samples for JS, Node, Java, Swift, and Python, plus a note pointing
users to channel.getMessage() when they only need the latest summary.
Also promotes the "Annotation message properties" subheading to a
top-level heading.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the annotations API surface to the realtime and rest SDK
reference pages, which previously documented only the Message
annotations property and a minimal MessageAnnotations entry.

- Adds `RealtimeAnnotations` (publish/delete/get/subscribe/unsubscribe)
  and `RestAnnotations` (publish/delete/get) sections to the channels
  pages, plus a Channel.annotations property pointing to them.
- Adds Annotation, OutboundAnnotation (JS/Cocoa), AnnotationAction,
  GetAnnotationsParams (JS), ARTAnnotationsQuery (Cocoa), and the
  per-language summary entry types (SummaryClientIdList,
  SummaryClientIdCounts, SummaryTotal, plus the Java `Summary`
  wrapper) to realtime-sdk/types.mdx.
- Updates the MessageAnnotations.summary row to describe the typed
  structure per language rather than leaving it as JsonObject.
- Restricts new content to languages that actually ship the API:
  JS, Node, Java, Swift, Objective-C, Python.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Drop the #summary-entry intra-page link for languages where the
  Summary entry types section is not rendered (csharp, go, flutter,
  ruby, php), so the row prose still works without a broken anchor.
- Clarify which Annotation fields are user-settable when publishing
  vs server- or SDK-populated, rather than calling all non-(type,
  name, count, data) fields "server-set" — extras and encoding are
  user-settable, and action / messageSerial are SDK-set on publish.
- Switch the messages/annotations.mdx paginated-result link from
  rest-sdk/types to realtime-sdk/types, matching the wider docs
  convention for cross-product guide pages (14 vs 6 references).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-app Create a Heroku review app

Development

Successfully merging this pull request may close these issues.

4 participants