Build share dialogs, filterable overview pages, and a whole lot more with REST APIs
We've added new API endpoints that enable you to build core parts of multiplayer products such as share dialogs with permissions, filterable overview pages, groups with permissions, and more.
At Liveblocks, our mission is to empower companies and developers to create
amazing document‑based collaborative products to enable people to feel more
connected and work better together.
The first foundational step to accomplish this mission was about distributing
tools and APIs that made it dead simple for developers to build
multiplayer editor experiences. What do we mean by that? Think of
the Figma’s, Notion’s, and Pitch’s of the world.
But outside of their collaborative editors, what do all those products also have
in common? They have a great document/file browsing experience, a smooth
share/invite flow driving organic product‑led growth, custom group/user
permissions, and more!
Figma file browsing experience automatically updates as people join and make changes to files.
People can easily be invited to Figma files by sharing the URL or using their share dialog.
In Notion, documents are listed in both the sidebar and the documents themselves.
People can easily be invited to Notion files by sharing the URL or using their share dialog.
Pitch document browsing experience automatically updates as people join and make changes to presentations.
People can easily be invited to Pitch presentations by sharing the URL or using their share dialog.
Today, we’re excited to announce a new set of REST APIs that will help you build
those critical experiences too. The possibilities are endless, but here are a
few common collaborative UI patterns we’d like to highlight today:
The first major improvement is that rooms (or documents in this context) can
have different permission types assigned at three different levels: default,
groups, and users. We designed this solution to be easy-to-use, yet powerful and
flexible, enabling companies to design and build permission systems that fit
their unique requirements.
For instance, you can now easily add a world-class share dialog that will
organically drive more people to your product.
To create the invitation system above, first we need to give a user a userId
when authenticating, for example within
authorize from @liveblocks/node.
The invitation system can also be extended to groups of people too, for instance
you could set permissions for the "engineering" group. To do this, first give
users their groups when authenticating.
With this update, rooms can also have custom metadata associated with them,
enabling you to build filterable and paginated overview pages.
For instance, if you have different document types in your product, it is now
easy to expose those types as a filter—making it easy for people to find what
they’re looking for.
One way to edit metadata is to use the
create room API. In this
example, we’re creating a new room with a custom type metadata, and setting it
to "whiteboard".
And if you have hundreds of documents created, Liveblocks automatically takes
care of pagination by returning the nextPage URL in the response—making it
easy to fetch the next page by either clicking on a button or some sort of
infinite scrolling behavior.
{"nextPage":"/v2/rooms?startingAfter=W1siaWQiLCJVRzhWYl82SHRUS0NzXzFvci1HZHQiXSxbImNyZWF0ZWRBdCIsMTY2MDAwMDk4ODEzN11d","data":[{"type":"room","id":"room-id","lastConnectionAt":"2022-09-22T10:23:15.281Z","createdAt":"2022-09-22T10:23:15.281Z","metadata":{"type":"whiteboard"},"defaultAccesses":["room:write"]}// more rooms data would show here]}
With our new API endpoints, you can also create fully dedicated views for
groups. Groups are a common pattern in seat-based collaborative products and are
often used to organise documents for different teams and projects.
For instance, if you want to enable your users to configure groups, you could
easily list them in side panel in your product overview page.
We’d then use the
get rooms API to retrieve a
list of rooms the group has access to.
This month, we want to send a special shout-out to
Vinod Santharam and
Florent Lefebvre for their contribution. If
you want to learn more about all the API endpoints we released, please check the
API Reference. See you soon for the
next update!