Skip to content

Helping our Slack community ask questions without fear of being judged

License

Notifications You must be signed in to change notification settings

dre8597/AskingForAFriend

 
 

Repository files navigation

License: MIT codecov Total alerts Language grade: JavaScript

Asking for a Friend

Helping our Slack community ask questions without fear of being judged

Screenshot

Once installed in your workspace, try it out by clicking the lightning bolt at the bottom left of the text box in Slack and clicking Ask question anonymously in the list of shortcuts.

After asking your question, it will appear like this: Screenshot

Development

Environment Variables

Project environment variables should first be defined in .env.sample without real values for their data (that file is tracked by git). After cloning, make sure to duplicate .env.sample as .env and then fill in all required variables using the details provided in the section below.

Dependencies

This project is reliant on the installation of the following dependencies:

After downlodaing the dependencies above, install all NPM dependencies by running npm i.

Create a Slack App

Before being able to run the app locally, you'll need to create a Slack app and configure it with the appropriate permissions:

  • Create an app on the Slack API Site
  • Using the sidebar, navigate to "OAuth & Permissions" and enable them
    • Under 'Scopes' --> 'Bot Token Scopes' click Add an OAuth Scope and add the following scope:
      • chat:write
      • chat:write.public
  • Using the sidebar, navigate to the "App Home"
    • Scroll to "_Your App's Presence in Slack" and click "Edit" next to "App Display Name" (using Asking for a Friend for the name and asking-for-a-friend for the username is recommended)
    • We also recommend enabling "Always Show My Bot as Online"
    • Finally, in the Show Tabs section, disable the Messages Tab
  • Using the sidebar, navigate to the "Basic Information", scroll down, copy the Signing Secret value and use it to replace the SLACK_SIGNING_SECRET value in your .env
  • Using the sidebar, navigate to the "Install App" and click "Reinstall App"
    • Once finished, copy the Bot User OAuth Access Token value and use it to replace the SLACK_TOKEN value in your .env

Once the above steps are finished, you'll need to connect your Slack app to your app running locally. Follow the steps in the Starting the App section below. After the app is running, you can use ngrok to create a publicly accessible URL. Copy that URL and head back to your app's settings:

  • Using the sidebar, navigate to "Interactivity & Shortcuts" and enable them
    • For the Request URL field, use your app's URL and then append /slack/events
    • Under Shortcuts, chose "Create New Shortcut", chose "Global", and use the following values:
      • Name: Ask question anonymously
      • Short Description: Posts an anonymous question in the current channel
      • Callback ID: postAnonymousQuestion
    • Click "Save Changes" at the bottom
  • After clicking save, you should see a banner at the top of the page suggesting you reinstall the app; click Reinstall

Starting the App

The best way to start the app and work on it is by using npm run dev, which will start the app and then restart the app whenever a TypeScript file changes. After modifying a non-Typescript file, restart the app by typing rs into the same terminal you ran npm run dev from and then hitting return.

After the app starts, it will be accessible on localhost:3000 (unless the port was modified via .env).

Contributing

Interested in contributing to the project? Check out our Contributing Guidelines.

About

Helping our Slack community ask questions without fear of being judged

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 92.4%
  • JavaScript 7.6%