An express application which ingests the following data into Orbit:
- Active participants in Twitch stream chat
- YouTube users who leave comments on a specified channel
- Questions asked on Stackoverflow
Rename .env.example
to .env
and fill out all of the fields for the components you wish to use. The following environment variables are always required:
- ORBIT_WS - the name of your Orbit workspace
- ORBIT_KEY - an API key for your Orbit user (it is reommended that you use another user for API access)
If you don't want to use any components, just remove them from index.js
.
$ npm run start # spins up application
$ npm run dev # spins up app with nodemon and ngrok
If you have a paid ngrok account, add the NGROK_TOKEN
environment variable to get custom domains based on the project name in package.json
.
The orbit component wraps the Orbit API and allows for the addition and retrieval of activities.
const orbit = require('./orbit.js')
await orbit.addActivity({
activity: {},
member: {},
identity: {}
})
await orbit.getActivities('activity:type')
- No rate-limiting measures have been implemented
- orbit.getActivities() only returns the first 500 items
The twitchChat component connects to a channel's Twitch channel and adds activities the first time a user sends a message into the chat while a stream is live, and when they are banned.
When banned, the 'Banned' tag is added to the member. Mod messages are ignored.
To set up the twitchChat component:
- Generate Twitch OAuth Token
- Register a Twitch application
- Add the following environment variables:
- TWITCH_CHANNEL - the Twitch channel to watch chat for
- TWITCH_USER - your twitch username for auth
- TWITCH_USER_TOKEN - your twitch oauth token starting 'oauth:'
- TWITCH_CLIENT_ID - twitch application client id
- TWITCH_CLIENT_SECRET - twitch application client secret
- An activity is added every time a message is sent, and the application swallows the Orbit error if there is a matching key (already a user message logged for this stream).
- No rate-limiting measures on the assumption 120 messages will not be sent per minute.
The youtubeComments component runs a daily cron job. On a daily schedule, all comments are retrieved from Orbit and YouTube on every video posted by a specificed channel. New comments are added as Orbit activities.
To set up the youtubeComments component:
- Register a YouTube Application and API Key
- Locate your YouTube Channel ID
- Add the following environment variables:
- YOUTUBE_CHANNEL_USERNAME - channel username to get videos from
- YOUTUBE_API_KEY - api key from step 1
- YOUTUBE_CHANNEL_ID - your ID from step 2
- Does not paginate the Orbit API when getting existing activities. You are limited to the first 500.
- No rate-limiting measures on the assumption 120 comments won't be ingested at the same time.
The stackoverflowQuestions component runs on a daily cron job. On a daily schedule, all questions are retrieved from Orbit and on Stackoverflow from a specified list of tags. The component then visits each question owner's profile and also grabs their Twitter & GitHub usernames, if present. New questions are added as Orbit activities.
Note that a question requires only one of these tags to be included in the results, not all.
To set up the stackoverflowQuestions component:
- Register a StackExchange App and note the app key
- Add the following environment variables:
- STACK_KEY - your app key
- STACK_TERMS - comma-separated tag list
- Does not paginate the Orbit API when getting existing activities. You are limited to the first 500.
- Only will ingest 120 questions per run. It is recommended you manually run the app a few times to backfill data 120 activities at a time.
- Does not include any answers.
In the interest of fostering an open and welcoming environment, we strive to make participation in our project and our community a harassment-free experience for everyone. Please check out our Code of Conduct in full.
We ❤️ contributions from everyone! Check out the Contributing Guidelines for more information.
This project is subject to the MIT License