russellmcc / skeletron

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SKELETRON - a fun slack app to answer questions

Setup

Use node 12.x and its corresponding npm.

cp _firebaserc .firebaserc
vi .firebaserc # set your own project

npm install -g firebase-tools
firebase login
firebase functions:config:set slack.signing_secret=xxx
firebase functions:config:set slack.bot_token=xoxb-111-111-xxx
firebase functions:config:set slack.user_token=xoxp-111-111-xxx

firebase functions:config:set openai.organization=xxx
firebase functions:config:set openai.key=xxx
firebase functions:config:set skeletron.company="Acme, inc."
firebase functions:config:set skeletron.company_description="a company that builds various widgets"
firebase functions:config:set skeletron.specialty="building frobulent widgets"

How to run the app on your laptop

cd functions
npm i
firebase functions:config:get > .runtimeconfig.json
cd -
firebase serve

I recommend ngrok to connect your local server to a public url slack can access

How to deploy

firebase deploy

How to configure Slack apps/Firebase

Slack App

https://api.slack.com/apps

  • Set https://{your domain}.cloudfunctions.net/slack/events as the Request URL for “Event Subscriptions”)
  • Add the following auth scopes:
    • Bot: channels:history
    • Bot: channels:read
    • Bot: chat:write
    • Bot: reactions:read
    • User: search:read
  • Subscribe to reaction_added event
  • Install the app to your development workspace
  • Create a “skeletron” emoji. use the included profile.png picture if you want.

Cloud Functions for Firebase

You have nothing to configure. Don’t forget enabling the billing info if it’s your first time to use it.

How to make sure if it works

  • Go the development Slack workspace
  • Invite the bot user to a channel
  • add skull emoji to message

LICENSE

GNU Affero General Public License v3.0 or later, see COPYING.

Source Works

Note that this code is based on “Bolt app running on Cloud Functions for Firebase”, used under the MIT License:

Copyright (c) Kazuhiro Sera

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

License:GNU Affero General Public License v3.0


Languages

Language:JavaScript 100.0%