Boost Your Creativity with Roam Serendipity

Ramses Oudt
Ramses Oudt
Boost Your Creativity with Roam Serendipity

Serendipity pulls random blocks to your Daily Notes Page. This comes in handy when you want to start your day with a boost of creativity—which is essentially seeing the connection between otherwise unconnected ideas.

While it’s possible to pull random blocks from your graph using SmartBlocks, Serendipity makes it easier by providing a user interface to specify what blocks you want to pull and then pulls them automatically for you every day.

How to install Serendipity

Serendipity is a JavaScript plugin that needs to be added to the roam/js page. See here how to create this page and how to add plugins to it.

Once you’re at step 4, paste the following code block in the JavaScript block:

var existing = document.getElementById("roamjs-serendipity");
if (!existing) {
  var extension = document.createElement("script");
  extension.src = "https://roamjs.com/serendipity.js";
  extension.id = "roamjs-serendipity";
  extension.async = true;
  extension.type = "text/javascript";
  document.getElementsByTagName("head")[0].appendChild(extension);
}

Alternatively, go to the RoamJS site and click the blue COPY EXTENSION button and paste it on your roam/js page.

It should look like this on the page:

To activate the plugin, click the red button that says Yes, I know what I'm doing.

The block now turns yellow, indicating the plugin is active. Refresh Roam to make sure the plugin is fully loaded.

How to use Serendipity

Serendipity works automatically every time you open your Roam graph and the plugin hasn’t pulled blocks yet that day (or when you’ve deleted the pulled blocks of that day). You can specify what type of blocks it references through the roam/js/serendipity page the plugin creates.

From the settings page (roam/js/serendipity), you have the following options:

  • includes defines the tag(s) the plugin will look for. Any block (or its children) with this tag can be pulled by the plugin.
  • excludes defines the tag(s) the plugin will not look for. None of the blocks (nor its children) with this tag can be pulled by the plugin.
  • timeout defines the amount of days that must pass before a block can be pulled again by the plugin. By default set to 0 (disabled).
  • label defines the text that the randomly pulled blocks are nested under. By default set to #[[roam/js/serendipity]].
  • count defines the maximum amount of blocks that are pulled each day. By default set to 3.
  • character minimum defines the amount of characters a block must contain to be pulled.
  • word minimum defines the amount of word a block must contain to be pulled.

While the plugin works automatically when you open your graph, you can also trigger it without refreshing your graph. Simply add the {{serendipity}} shortcode to your Daily Notes page and click it. This is useful to get a fresh pull of blocks (but make sure you first delete the blocks that were already pulled that day, otherwise it won’t work).

Additional resources

Want to see the Serendipity plugin in action? See this demo by its creator David Vargas:



Join the conversation.

Great! Check your inbox and click the link
Great! Next, complete checkout for full access to RoamStack
Welcome back! You've successfully signed in
You've successfully subscribed to RoamStack
Success! Click here to start your premium onboarding.
Success! Your billing info has been updated
Your billing was not updated