Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 2.05 KB

slack_auth_setup.md

File metadata and controls

44 lines (33 loc) · 2.05 KB

Slack Auth Setup

Steps

In order to interact with the Slack API, you will need to set up an authentication token. This token will not be shared, so both partners must follow these steps.

  1. Go to https://api.slack.com/apps

    • You might have to sign in using your Slack credentials
  2. Click the green Create New App button

  3. Fill out the details in the modal window

    • For the name of your app use ClassName - YourName - API Project
    • For the workspace, use the Slack workspace for your cohort

    Create New App Modal

    • Click the green Create App button
  4. Click Add features and functionality, then Permissions

  5. Scroll down to Scopes, and add the following three permissions:

    • chat:write:bot
    • channels:read
    • users:read

    Add Scopes

    • Click the green Save Changes button
  6. Install and authorize the app:

    • Scroll to the top of the page and click the green Install App to Workspace button
    • Check that your app's permissions are correct and click the green Authorize button

    Authorize the App

  7. You should now see an OAuth Access Token. Copy this and paste it into your app's .env file. OAuth Token

    • The .env file should already be in the provided .gitignore, but it doesn't hurt to double check!

Your application should now be able to access Slack!

Verification

To verify that you've set up the Slack token correctly, work with your partner to write a script that does the following:

  1. Use the dotenv gem to load environment variables
  2. Use HTTParty to send a GET request to the channels.list endpoint
  3. Check that the request completed successfully, and print relevant information to the console if it didn't
  4. Loop through the results and print out the name of each channel

If your tokens are set up correctly, each of you should be able to run this script.