Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@orbit-love/reddit

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orbit-love/reddit

Integrate Reddit interactions into Orbit workspaces

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
decreased by-14.44%
Maintainers
2
Weekly downloads
 
Created
Source

Reddit to Orbit Workspace

Build Status npm version Contributor Covenant

This is a JavaScript package that can be used to integrate new Reddit interactions from a specified subreddit into your organization's Orbit workspace.

:sparkles:

This is a community project. The Orbit team does its best to maintain it and keep it up to date with any recent API changes.

We welcome community contributions to make sure that it stays current.

:sparkles:

There are three ways to use this integration. Install package - build and run your own applications. Run the CLI - run on-demand directly from your terminal. Schedule an automation with GitHub - get started in minutes - no coding required

First Time Setup

  1. Head to your Reddit App Preferences.
  2. Create a new app with the following settings:
    1. Name: orbit-community-integration
    2. Type: script
    3. Description: orbit.love community integration
    4. About URL: https://github.com/orbit-love/community-js-reddit-orbit
    5. Redirect URI: https://orbit.love
  3. Take note of your Client ID which is just below your app name, and your Client Secret.

Application Credentials

The application requires the following environment variables:

VariableDescriptionMore Info
REDDIT_CLIENT_IDClient ID for your Reddit AppFollow the guide above
REDDIT_CLIENT_SECRETClient Secret for your Reddit AppFollow the guide above
REDDIT_USERNAMEYour Reddit usernameYour account credentials
REDDIT_PASSWORDYour Reddit passwordYour account credentials
ORBIT_API_KEYAPI key for OrbitFound in Account Settings in your Orbit workspace
ORBIT_WORKSPACE_IDID for your Orbit workspaceLast part of the Orbit workspace URL, i.e. https://app.orbit.love/my-workspace, the ID is my-workspace

Package Usage

Install the package with the following command

$ npm install @orbit-love/reddit

The standard initialization of the library requires the following signature:

const OrbitReddit = require('@orbit-love/reddit')
const orbitReddit = new OrbitReddit('orbitWorkspaceId', 'orbitApiKey', 'redditClientId', 'redditClientSecret', 'redditUsername', 'redditPassword')

If you have the following environment variables set: ORBIT_WORKSPACE_ID, ORBIT_API_KEY, REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, REDDIT_USERNAME and REDDIT_PASSWORD then you can initialize the client as follows:

const OrbitReddit = require('@orbit-love/reddit')
const orbitReddit = new OrbitReddit()

Add New Posts In Subreddit

const OrbitReddit = require('@orbit-love/reddit')
const orbitReddit = new OrbitReddit()

// Allows you to go back a number of hours and only get posts in that timeframe
const posts = await orbitReddit.getPosts({ subreddit: 'javascript', hours: 24 })
const prepared = await orbitReddit.preparePosts(posts)
const added = await orbitReddit.addActivities(prepared)
console.log(added) // "Added n activities to your Orbit workspace"

Add New Comments In Subreddit

const OrbitReddit = require('@orbit-love/reddit')
const orbitReddit = new OrbitReddit()

// Allows you to go back a number of hours and only get posts in that timeframe
const comments = await orbitReddit.getComments({ subreddit: 'javascript', hours: 24 })
const prepared = await orbitReddit.prepareComments(comments)
const added = await orbitReddit.addActivities(prepared)
console.log(added) // "Added n activities to your Orbit workspace"

CLI Usage

To use this package you do not need to install it, but will need Node.js installed on your machine.

npx @orbit-love/reddit --posts --subreddit=javascript
npx @orbit-love/reddit --comments --subreddit=javascript

Timeframe

By default this will get the last 24 hours worth of activity, but this can be explicitly overridden:

npx @orbit-love/reddit --posts --subreddit=javascript --hours=12

Filtering

You can pass in a --filter=term flag to filter the results by a single term.

  • For posts this will match if the post title, url or body text contain the term.
  • For comments this will match if it was left on a post with a title containing the term, or the comment itself contains the term.

GitHub Actions Automation Setup

⚡ You can set up this integration in a matter of minutes using our GitHub Actions template. It will run regularly to add new activities to your Orbit workspace. All you need is a GitHub account.

See our guide for setting up this automation

Contributing

We 💜 contributions from everyone! Check out the Contributing Guidelines for more information.

License

This project is under the MIT License.

Code of Conduct

This project uses the Contributor Code of Conduct. We ask everyone to please adhere by its guidelines.

Keywords

FAQs

Package last updated on 04 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc