• DocsDocs
  • PricingPricing
Book a demo
Sign in
Sign in
Book a demo
    • Ready-made features
      • AI Copilots
        AI Copilots

        In-app AI agents that feel human

      • Comments
        Comments

        Contextual commenting

      • Multiplayer Editing
        Multiplayer Editing

        Realtime collaboration

      • Notifications
        Notifications

        Smart alerts for your app

      • Presence
        Presence

        Realtime presence indicators

    • Platform
      • Monitoring Dashboard
        Monitoring Dashboard

        Monitor your product

      • Realtime Infrastructure
        Realtime Infrastructure

        Hosted WebSocket infrastructure

    • Tools
      • Examples

        Gallery of open source examples

      • Next.js Starter Kit

        Kickstart your Next.js collaborative app

      • DevTools

        Browser extension for debugging

      • Tutorial

        Step-by-step interactive tutorial

      • Guides

        How-to guides and tutorial

    • Company
      • Blog

        The latest from Liveblocks

      • Customers

        The teams Liveblocks empowers

      • Changelog

        Weekly product updates

      • Security

        Our approach to security

      • About

        The story and team behind Liveblocks

  • Docs
  • Pricing
  • Ready-made features
    • AI Copilots
    • Comments
    • Multiplayer Editing
    • Notifications
    • Presence
    Platform
    • Monitoring Dashboard
    • Realtime Infrastructure
    Solutions
    • People platforms
    • Sales tools
    • Startups
    Use cases
    • Multiplayer forms
    • Multiplayer text editor
    • Multiplayer creative tools
    • Multiplayer whiteboard
    • Comments
    • Sharing and permissions
    • Document browsing
  • Resources
    • Documentation
    • Examples
    • React components
    • DevTools
    • Next.js Starter Kit
    • Tutorial
    • Guides
    • Release notes
    Technologies
    • Next.js
    • React
    • JavaScript
    • Redux
    • Zustand
    • Yjs
    • Tiptap
    • BlockNote
    • Slate
    • Lexical
    • Quill
    • Monaco
    • CodeMirror
  • Company
    • Pricing
    • Blog
    • Customers
    • Changelog
    • About
    • Contact us
    • Careers
    • Terms of service
    • Privacy policy
    • DPA
    • Security
    • Trust center
    • Subprocessors
  • HomepageSystem status
    • Github
    • Discord
    • X
    • LinkedIn
    • YouTube
    © 2025 Liveblocks Inc.
Blog/Updates

Liveblocks 1.8: Typed REST APIs and easy Comments notifications

Today we're introducing new typed REST API methods, making integrating Liveblocks into your back end easier than ever. We're also adding functions to help you transform comments, and create email notifications more easily.

on November 22nd, 2023
Liveblocks 1.8: Typed REST APIs and easy Comments notifications
November 22nd, 2023·5 min read
Share article

With Liveblocks 1.8, we’re introducing an improved way to consume our REST APIs with types, making it quicker to integrate Liveblocks into the back end of your application. We’re also adding a way to transform comments into HTML, Markdown, and more, meaning sending formatted email notifications is now simpler.

  • Typed REST APIs
  • Transforming Comments
  • Sending Comments email notifications

Upgrade now

Start using the new features now by updating each Liveblocks package in your project to the @latest version.

$npm install @liveblocks/client@latest @liveblocks/react@latest @liveblocks/react-comments@latest liveblocks/node@latest

If you use any other Liveblocks packages, make sure to include those too.

Typed REST APIs

It’s now possible to access our REST APIs using the @liveblocks/node package. Previously, the only way to access our REST APIs in Node.js was via a fetch call.

// ❌ Before, using fetchconst response = await fetch("https://api.liveblocks.io/v2/rooms", {  method: "POST",  headers: {    Authorization: "Bearer {{SECRET_KEY}}",  },  body: JSON.stringify({    id: "my-room-name",    defaultAccesses: ["room:write"],  }),});
// ❌ No typesconst room = await response.json();

From now, you can set up a Liveblocks client, call a corresponding method, and get type hints on the returned value.

// ✅ After, using `Liveblocks` and typed methodsconst liveblocks = new Liveblocks({  secret: "sk_prod_xxxxxxxxxxxxxxxxxxxxxxxx",});
// ✅ Fully-typed roomconst room = await liveblocks.createRoom("my-room-name", { defaultAccesses: ["room:write"],});

Every existing REST API is supported, and we’ll continue to add them in the future. Here’s an example of some more methods.

// Get users currently in a roomconst activeUsers = await liveblocks.getActiveUsers("my-room-id");
// Get Storage data as JSONconst storage = await liveblocks.getStorageDocument("my-room-id", "json");
// Update Yjs dataawait liveblocks.sendYjsBinaryUpdate("my-room-id", { update: Y.encodeStateAsUpdate(yDoc),});
// Get the last 20 rooms that contain your custom metadataconst canvasRooms = await liveblocks.getRooms({ limit: 20, metadata: { myRoomType: "canvas" },});

Find all the methods in the API reference under @liveblocks/node.

Transforming comments

Using Liveblocks 1.8, you can transform a comment’s text into different formats, for example HTML, Markdown, or a plain string of text. Here’s an example of a comment converted into two different formats.

Comment with example body: 'Thank you so much @Emil Joyce!', with 'so much' in bold
Thank you **so much** @Emil Joyce!
<p>Thank you <b>so much</b> <span data-mention>@Emil Joyce</span>!</p>

To enable this, we’ve added a new helper function called stringifyCommentBody. Here’s one way it could be used, alongside Liveblocks.getComment.

// Retrieve a commentconst comment = await liveblocks.getComment({  roomId: "my-room-id",  threadId: "my-thread-id",  commentId: "my-comment-id",});
// Convert comment body into Markdownconst markdownBody = await stringifyCommentBody(comment.body, { format: "markdown",});
// "Thank you **so much** emil.joyce@example.com!"console.log(markdownBody);

You can also customize the output format, either completely, or on an element-by-element basis. Make sure to read stringifyCommentBody to learn more.

Get mentioned IDs

As a bonus, we’ve also added a utility that makes it easy to find each user mentioned in a comment’s body. It’s called getMentionedIdsFromCommentBody, and here’s how it works.

Comment with example body: 'Could you take a look at this @Jody Hekla, @Tatum Paolo?'
// Retrieve a commentconst comment = await liveblocks.getComment({  roomId: "my-room-id",  threadId: "my-thread-id",  commentId: "my-comment-id",});
// Get IDs for each user mentionedconst mentionedIds = getMentionedIdsFromCommentBody(comment.body);
// ["jody.hekla@example.com", "tatum.paolo@example.com"]console.log(mentionedIds);

Sending Comments email notifications

Using the new REST API and comment transformation functions, it’s easier than ever to send formatted email notifications. You can trigger events when comments are created using our webhooks, and in particular the CommentCreatedEvent.

Example comment email notification

Here’s an example of a Next.js route handler that listens for new comments, then sends a formatted HTML email with Resend.

To learn exactly how this works, we’ve written a full guide on sending email notifications when comments are created.

Contributors

Huge thanks to everyone who contributed and specifically to Nimesh Nayaju and Marc Bouchenoire for their work on the REST API methods and the Comments functions respectively. Keep checking out the changelog for the full release notes–see you next time!

Product updatesStorage

Ready to get started?

Join thousands of companies using Liveblocks ready‑made collaborative features to drive growth in their products.

Book a demo

Related blog posts

  • What's new in Liveblocks: August 2025

    What's new in Liveblocks: August 2025

    Picture of Chris Nicholas
    September 17th
    Updates
  • What’s new in Liveblocks: July 2025

    What’s new in Liveblocks: July 2025

    Picture of Chris Nicholas
    August 5th
    Updates
  • What’s new in Liveblocks: June 2025

    What’s new in Liveblocks: June 2025

    Picture of Chris Nicholas
    July 15th
    Updates