PLATFORM to Orbit Workspace
This is a JavaScript package that can be used to integrate YouTube comments from videos uploaded to a specified channel into your organization's Orbit workspace.
✨ 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. ✨ |
|---|
First Time Setup
To set up this integration you will need some details from YouTube.
- Create a project in the Google Developers Console
- After creating your project, make sure the YouTube Data API is one of the services that your application is registered to use.
- Go to the Credentials area of your application and create an API Key. Take note of the API Key as it will only be shown once.
- Get your Channel's ID by following these steps.
Application Credentials
The application requires the following environment variables:
| Variable | Description | More Info |
|---|---|---|
YOUTUBE_API_KEY |
Allows you to use the YouTube Data API | Follow the guide above |
YOUTUBE_CHANNEL_ID |
The ID of the channel you want to scan for comments | Follow the guide above |
ORBIT_API_KEY |
API key for Orbit | Found in Account Settings in your Orbit workspace |
ORBIT_WORKSPACE_ID |
ID for your Orbit workspace | Last 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/youtube
Use the package with the following snippet.
const OrbitYouTube = require('@orbit-love/youtube')
const orbitYouTube = new OrbitYouTube()
// Allows you to go back a number of hours and only get comments in that timeframe
const videos = await orbitYouTube.getComments({ channelId: YOUTUBE_CHANNEL_ID, hours: 24 })
const comments = await orbitYouTube.prepareComments(videos)
const response = await orbitYouTube.addActivities(comments)
console.log(response) // "Added n activities to the workspace-id Orbit workspace"
The standard initialization of the library requires the following signature:
const OrbitYouTube = require('@orbit-love/youtube')
const orbitYouTube = new OrbitYouTube('orbitWorkspaceId', 'orbitApiKey', 'ytApiKey', 'ytChannelId')
If you have the following environment variables set: ORBIT_WORKSPACE_ID, ORBIT_API_KEY, YOUTUBE_API_KEY, and YOUTUBE_CHANNEL_ID then you can initialize the client as follows:
const OrbitYouTube = require('@orbit-love/youtube')
const orbitYouTube = new OrbitYouTube()
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/youtube --comments --channel=id
By default this will get the last 24 hours worth of activity, but this can be explicitly overridden:
npx @orbit-love/youtube --comments --channel=id --hours=24
To use the CLI you must have the following environment variables set: ORBIT_WORKSPACE_ID, ORBIT_API_KEY, YOUTUBE_API_KEY, and YOUTUBE_CHANNEL_ID.
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.
