npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

slack2roam

v0.1.2

Published

Script for converting Slack export JSON into Roam import JSON

Downloads

4

Readme

Script for converting Slack JSON into Roam import JSON.

Works as both a node module for use in other projects, as well as a command-line interface. The cli can be used in many diverse ways.

As node module

Install to your node project

npm install --save slack2roam

Use it

const slack2roam = require('slack2roam')
const users = [{
  id: "U0ABC123",
  name: "malcolmocean",
  real_name: "Malcolm Ocean",
}, {
  id: "U0DEF456",
  name: "conaw",
  real_name: "Conor White-Sullivan",
}]
const channel = {name: 'general'}
const messages = [{
    "type": "message",
    "text": "Hey it's a message in slack",
    "user": "U0ABC123",
    "ts": "1585242429.009300",
}, {
    "type": "message",
    "text": "Wow, here's another it's a message in slack!",
    "user": "U0DEF456",
    "ts": "1585893429.009300",
}]
const options = {uPageNameKey: 'real_name'} // defaults to 'name', ie username
slack2roam.makeUserMap(users)
const roamJson = slack2roam.slackChannelToRoamPage(channel, messages, options)

result:

  "title": "general",
  "children": [
    {
      "string": "[[March 26th, 2020]]",
      "children": [
        {
          "uid": "slack_general_1585242429_009300",
          "create-time": 1585242429093,
          "string": "[[Malcolm Ocean]] 13:07\nHey it's a message in slack"
        }
      ]
    },
    {
      "string": "[[April 3rd, 2020]]",
      "children": [
        {
          "uid": "slack_general_1585893429_009300",
          "create-time": 1585893429093,
          "string": "[[Conor White-Sullivan]] 01:57\nWow, here's another it's a message in slack!"
        }
      ]
    }
  ]
}

As command-line script

Install as a command-line tool

If you have NodeJS installed, npm comes with it. If not, get it here.

npm install --global slack2roam

Use it

The command-line tool expects the command to be run from a slack export folder that contains the following:

  • users.json
  • channels.json
  • general/
    • 2020-06-11.json
    • 2020-06-12.json
    • (other dates)
  • random/
  • (other channel folders)

(It doesn't specifically expect general/ and random/, those are just examples)

Once you're in that folder, you can just run this:

slack2roam -o roam_data.json

This will output to the file roam_data.json. If you omit the -o flag it will show you a preview in the console instead.

Each channel listed in channels.json gets its own page in roam.

If you want to provide options, add this flag with a JSON string

--options='{"uPageNameKey":"real_name", "workspaceName":"mycompany", "timeOfDayFormat": "ampm"}'

Importing in bulk is best as it will do optimal things with threading, but if you import stuff later that replies to earlier threads, then it will block reference them. This uses custom UIDs, which is the reason you might want to provide a workspaceName above, since slack's UIDs are probably only per-workspace and otherwise you could get a collision if you're importing from multiple workspaces. This is fairly unlikely, especially since slack2roam also puts the channel name into the UID.

Areas for improvement

  • custom timezone support
  • handle edit timestamp better if date changed
  • be better at reformatting text
  • more command-line features, like specifying only one channel
  • more options!

Contributing

Ummm yeah hmu. I haven't done much managing of OSS projects but if you submit a pull request we can figure something out. Talk to me about it on Twitter @Malcolm_Ocean as I don't check GitHub notifications much.

See here for Roam's JSON schema.

Tip me 🤑

If this is hugely valuable to you, you can tip me here, or also go check out my meta-systematic, goal-oriented productivity app, Complice.