Skip to content

jakesutton/slack-shareto-command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sharing great things using a Slash Command

Have you ever wanted to share something awesome with a channel on Slack and had to do something like this?

  1. Join the channel
  2. Share your wonderful content
  3. Leave the channel

Well, I have created a slash commend to help you!

Use /shareto #channel [stuff you want to share}

This slash command will share share your content to a public channel regardless of your membership in that channel.

This is useful if you don't usually hang out in a channel but you find an interesting link that you know the members in that channel would love.

Setup

1. Remix this Glitch repo

Remix on Glitch

2. Create a Slack app

  1. Create an app at https://api.slack.com/apps
  2. Add a Slash command (See Add a Slash Command section below)
  3. Navigate to Bot Users and click "Add a Bot User" to create one.
  4. Navigate to the OAuth & Permissions page and make sure the following scopes are pre-selected:
    • commands
    • bot
  5. Click 'Save Changes' and install the app (You should get an OAuth access token after the installation)

Add a Slash Command

  1. Go back to the app settings and click on Slash Commands.
  2. Click the 'Create New Command' button and fill in the following:
    • Command: /shareto
    • Request URL: Your server or Glitch URL + /command
    • Short description: Share to public channels regardless of membership
    • Usage hint: #public-channel [text you want to share]

If you did "Remix" on Glitch, it auto-generate a new URL with two random words, so your Request URL should be like: https://fancy-feast.glitch.me/command.

Run this App

Set Environment Variables and run:

  1. Set the following environment variables to .env (see .env.sample):
    • SLACK_ACCESS_TOKEN: Your bot token, xoxb- (available on the OAuth & Permissions once you install the app)
    • SLACK_SIGNING_SECRET: Your app's Signing Secret (available on the Basic Information page)
  2. If you're running the app locally, run the app (npm start). Or if you're using Glitch, it automatically starts the app.

Credits

I based a lot of this code on the example I found here

About

A slash command to allow sharing to public channels regardless of channel membership

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published