TWITTER

The Twitter integration connects your Roam graph to Twitter!

Installation

You could use the Copy Extension button below to individually install this extension. To install, just paste anywhere in your Roam graph and click "Yes, I Know What I'm Doing".

Manual Installation

If the extension doesn't work after using the copy extension button above, try installing manually using the instructions below.

First create a block with the text {{[[roam/js]]}} on any page in your Roam DB. Then, create a single child of this block and type three backticks. A code block should appear. Copy this code and paste it into the child code block in your graph:

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

Finally, click "Yes, I Know What I'm Doing".


Usage

The RoamJS Twitter extension allows you to use your Roam graph as a client to your Twitter account! Included in this extension is the ability to:

  1. Send Tweets

  2. Schedule Tweets (premium)

  3. Import Tweets

Sending Tweets

When navigating to the roam/js/twitter page, a log in with Twitter button will be rendered on the configuration screen.

Clicking the button will create a popup window, prompting you to authorize RoamJS to be able to send tweets on your behalf. You may need to allow popups from Roam for this to work.

We would recommend having Use Locally checked on. This will store sensitive data RoamJS needs to send tweets in your browser instead of in Roam. This has the tradeoff of needing to log in per device. After authorizing RoamJS, the UI should display the username that is logged in.

To send a tweet, create a {{tweet}} button and nest the content of the tweet as a child.

The button will be replaced with a Twitter icon. Clicking the icon will render an overlay with a "Send Tweet" button.

Clicking "Send Tweet" will send the first child as the content of the Tweet!

If the tweet button has multiple children, clicking "Send Tweet" will send each block as a tweet as part of a single Tweet thread.

Images, gifs, or videos in the Roam Block inline with the rest of the tweet, will be uploaded as media embedded in the tweet! The ![](url) block text will be stripped from the tweet content. Up to four images, one gif, or one video are allowed by Twitter.

After Sending

There are various behaviours you could configure to occur after tweets are successfully sent.

It could be useful to denote which blocks in Roam have already been sent by moving them to another page or block reference after sending. On the roam/js/twitter page, you could add a block reference to the Sent field to denote where your tweet blocks in Roam should move to after they have been successfully sent

This will move all the blocks sent as children of this block upon sending.

The label each Sent tweet thread uses could be configured with the Label field. It supports the following placeholders:

  • {now} - Replaces with the current time

Instead of moving blocks to a configured destination, tweeted blocks could instead be edited upon sending. In the roam/js/twitter page, editing the Append Text field will specify text that will get added to the end of the tweet after sending. It supports the following placeholders:

  • {link} - The link of the published tweet.

Instead of appending text to individual tweet blocks, you could append text to the parent block of the tweet thread. This could be configured in the Append Parent tab in roam/js/twitter page. It supports the following placeholders:

  • {link} - The link of the first tweet of the thread

  • {now} - The time the tweet was successfully sent.

Demo

Scheduling

This is a premium feature. To subscribe, be sure to:

  • Add your RoamJS Token from https://roamjs.com/user#/Extensions to Roam, by opening the command palette and entering Set RoamJS Token. If you have used another premium extension from RoamJS, this step could be skipped.

  • Enable the scheduling feature from the roam/js/twitter page:

With this feature enabled, you could schedule Tweets to be sent at a later date directly from within Roam. You should see a new option to schedule a tweet:

This will store your tweet thread in RoamJS to be sent at the time you specify. To view all of your current tweet threads, go to the Scheduling Dashboard in the roam/js/twitter page:

For each scheduled tweet, you will see a clickable block reference pointing to the source tweet, the time you created the schedule, the time you scheduled the tweet for, and the current status. There are three statuses:

  • SUCCESS - Your scheduled tweet was successfully sent and clicking this status will take you to the link on Twitter

  • PENDING - Your tweet is still scheduled to be sent.

  • FAILED - Your tweet failed to send. Please contact support@roamjs.com for help with this issue.

This feature costs $1 per successfully sent thread. You will be billed once per month, based on the number of successfully sent threads in the billing period. You will not be charged for failed threads.

Demo

Twitter Feed

You could configure the extension to show a feed of all tweets you liked the previous day upon opening your daily notes page.

On the [[roam/js/twitter]] page, add a block that says feed and then reload Roam. Now navigate to the daily notes page or to today's page. A dialog will appear and show you a feed of all the tweets that were published yesterday and that you liked.

Clicking "Import" will add a #[[Twitter Feed]] tag to your Daily Notes page with links to all the tweets nested below it.

By default, the Twitter feed only appears on the current daily notes page and log. You can configure the feed to appear on any daily notes page by enabling the Any Day flag in the tab in the roam/js/twitter page.

By default, the Twitter feed queries the previous day's likes relative to the current daily note page, as it's meant to review a full day's of liked tweets. You can configure the feed to show the current day's tweets by enabling the Today flag in the tab in the roam/js/twitter page.

By default, the tweets are imported at the top of the page. Add a block that says bottom under the feed block to import the tweets to the bottom of the page.

By default, the Twitter feed just outputs links to the tweets into the daily note page. To customize the format, add a block under the feed block that says format. You could then specify the format as a child of the format block. There are certain placeholders that will get replaced in the format:

  • {text} - The text of the tweet
  • {link} - The link to the tweet
  • {handle} - The twitter handle of the user
  • {author} - The name of the user on Twitter

Demo

Searching Tweets

In any page, create a Twitter References button by typing in {{twitter references}} (case-insensitive) in a block. Upon clicking the button, the extension will clear the button and fill the page in with the tweets where you've mentioned that page title. So, if you've tweeted about books a lot on twitter, you can head over to the books page on roam, and then pull all your tweets about books!

One caveat is that this can only pull tweets made in the last 7 days.


Contributors

This extension is brought to you by RoamJS! If you are facing any issues reach out to support@roamjs.com or click on the chat button on the bottom right.

Other Extensions