Skip to content

vbrick/slack-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vbrick Video Slack App

Description

This is a Slack application (bot) that integrates Slack with Vbrick Rev. It uses Slack's web socket and HTTP API to display VOD and webcasts using the Rev video player within the Slack.

Features

When connected to a user's Vbrick Rev Account/Tennant

  • VOD link unfurling when a valid VOD URL is shared in any channel
  • Webcast Event link unfurling when a valid Event URL is shared in any channel
  • Searching active VODs using a slash command
  • Posting active VODs from the search command results when the Slack Bot is invited to the channel

Requirements

Software

  • Node.js (Recommended version 22.18.0 and above)
  • NPM (that comes with Node.js)

Hardware

  • Linux (Recommended with at least 4 vCPU, 4 GB RAM, 50GB of free disk space)

Installation Instructions

Rev Configuration

  1. Note your Vbrick Rev account ID found at Admin Settings > Accounts. This will be used as REV_ACCOUNT_ID in the .env file
  2. Create a Vbrick Rev API key found at Admin Settings > System Settings > API Keys. Record the API key name and secret for REV_API_KEY and REV_API_SECRET respectivley.
  3. Enable and create a JWT Key at Admin Settings > System Settings > User Security. When creating the JWT key, name it appropriatly and select 'Auto Generate Signing Certificate'. The name of this JWT token will be used for REV_JWT_KEY_NAME
  4. Enable 'Allow Sharing of Metadata for Private Videos' found at Admin Settings > Content Restriction > Sharing and Embedding
  5. Add 'Slack' to Recognized User Agents if it is not already there. It can be found at Admin Settings > Content Restriction > Sharing and Embedding

Slack configuration

  1. Create a Slack app using the template manifest found below. (Be sure to fill out the missing fields in the template)
  2. Click the Basic Information > App-level tokens > Generate Token and Scopes. Name the token as desired, and add scope connections:write. This generates a token to be used in SLACK_APP_TOKEN
  3. In the Basic Information tab, request to install the App to the desired workspace. Once the workspace admin approves this request, record the 'Bot User OAuth Token' for SLACK_BOT_TOKEN

Running the app

  1. Create the .env file, filling out each constant.
  2. Run npm ci
  3. Run node index.js

Running as a systemctl daemon

It is recommended to use a linux distribution that can utilize systemctl to run this application as a service. Here is an example configuration.

Adjust the WorkingDirectory and Environment variables to the appropriate values.

[Unit]
Description=Vbrick Slack App

[Service]
User=vbrick
Environment=NODE_ENV=production
#Environment="npm_config_proxy=http://10.4.4.4:3128" (if using proxy)
WorkingDirectory=/home/vbrick/vb-slack-app-dev
ExecStart=node index.js
Restart=on-failure
RestartSec=120

[Install]
WantedBy=multi-user.target

Sample .env

The various API keys are configured through a file named .env that should be placed in the root directory of the project

SLACK_APP_TOKEN=""    #  
SLACK_BOT_TOKEN=""    #
SLACK_COMMAND_NAME="" # Name of the slash command registered in the Slack Application settings; preceded with '/' ex. /video-search
REV_ACCOUNT_ID=""     # Rev account id found at Admin Settings > Accounts
REV_API_KEY=""        # Rev API key name created at Admin Settings > System Settings > API Keys
REV_API_SECRET=""     # Rev API secret created at Admin Settings > System Settings > API Keys
REV_JWT_KEY_NAME=""   # REV JWT Key name created at Admin Settings > System Settings > User Security
REV_TENANT_DOMAIN=""  # Domain of the Rev tenant ex. 'slack.vbrick.com'
LOG_LOCATION=""       # Path for the output location of any log files created by this app. If no path is provided, logs are placed in the route directory of the application ex. /var/log/vbrick

Sample Slack App Manifest

The fields name, description, background_color, and display_name (hex color code) can be configured to anything.

The field features.slash_commands.command must match the value of SLACK_COMMAND_NAME in the .env file.

features.unfurl_domains must have an elment that matches REV_TENANT_DOMAIN

{
    "display_information": {
        "name": "",
        "description": "",
        "background_color": ""
    },
    "features": {
        "bot_user": {
            "display_name": "",
            "always_online": false
        },
        "slash_commands": [
            {
                "command": "",
                "description": "Search Rev tenant for videos",
                "usage_hint": "Specify search query for videos",
                "should_escape": false
            }
        ],
        "unfurl_domains": [
            ""
        ]
    },
    "oauth_config": {
        "scopes": {
            "bot": [
                "channels:history",
                "chat:write",
                "commands",
                "links.embed:write",
                "links:read",
                "links:write",
                "users:read",
                "users:read.email",
                "im:write"
            ]
        }
    },
    "settings": {
        "event_subscriptions": {
            "bot_events": [
                "link_shared"
            ]
        },
        "interactivity": {
            "is_enabled": true
        },
        "org_deploy_enabled": false,
        "socket_mode_enabled": true,
        "token_rotation_enabled": false
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •