Coder Social home page Coder Social logo

slackapi / template-channel-naming Goto Github PK

View Code? Open in Web Editor NEW
28.0 28.0 15.0 76 KB

Sample Slack app that uses the Events API and interactive message to help enforce channel naming conventions

License: MIT License

JavaScript 100.00%
slack-blueprint slack-workflow-sample

template-channel-naming's Introduction

Channel Naming Slack App Template

โœจ Updated October 2018: As we have introduced some new features, this tutorial and the code samples have been updated! All the changes from the previous version of this example, read the DIFF.md


An example app that helps enforce channel naming conventions.

channel-naming (The GIF image is outdated, however, the functionality of this sample app reminds the same! ๐Ÿ™‡โ€โ™€๏ธ)

Setup

1. Clone this repo, or remix this on Glitch

git clone https://github.com/slackapi/template-channel-naming.git

Remix on Glitch

2. Create a Slack app

  1. Create an app at https://api.slack.com/apps
  2. At Bot Users, add a new bot user.
  3. Click on OAuth & Permissions and select the following scopes: chat:write, channels:read, chat:write.public
  4. Enable the interactive messages (See below Enable Interactive Messages)
  5. Enable events (See below Enable the Events API)
  6. Click 'Save Changes' and install the app to all channels (You should get an OAuth access token after the installation

3. Run locally or Remix on Glitch

  1. Set the following environment variables in .env (copy from .env.sample):
    • SLACK_ACCESS_TOKEN: Your app's xoxa- token (available on the Install App page)
    • SLACK_SIGNING_SECRET: Your app's Verification Token (available on the Basic Information page)
    • PORT: The port that you want to run the web server on (Default: 5000)
  2. If you're running the app locally:
    • Start the app (npm start)

4. Enable Interactive Messages

  1. Click on Interactive Components and enable the feature.
  2. Set the Request URL to your server URL + /interactions

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.

Enable the Events API

  1. Click on Events Subscriptions and enable events.
  2. Set the Request URL to your server (e.g. https://yourname.ngrok.com) or Glitch URL + /events
  3. On the same page, scroll down to Subscribe to Bot Events and subscribe to the channel_created and channel_rename events.

template-channel-naming's People

Contributors

ascendbruce avatar colmdoyle avatar girliemac avatar sachinr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

template-channel-naming's Issues

[BUG] Repeating messages/prompts for every event

Describe the bug

Running from Glitch, multiple messages are sent for each event. (The same goes for prompts when a template isn't found, or if a parent channel isn't defined.). I haven't tested locally, and only in Glitch.

Requirements (place an x in each of the [ ])**

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

To Reproduce

Steps to reproduce the behavior:
Do anything involving the sample

Expected behavior

I was only expecting to be prompted/notified once per event

Screenshots

If applicable, add screenshots to help explain your problem.
image
image

Reproducible in:

package version:
node version:
OS version(s):

Additional context

Add any other context about the problem here.

[BUG] Bots can not post messages to channels they don't belong to.

Describe the bug

Bots using Granular Scopes as part of the new Slack apps can't message channels they are not members of.

Requirements (place an x in each of the [ ])**

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

To Reproduce

Steps to reproduce the behavior: Simply install the app and create a new channel, the logs will report an error indicating the bot can't post a message to a channel it's not a member of.

Expected behavior

For the app to work as instructed.

Screenshots

If applicable, add screenshots to help explain your problem.

Reproducible in:

Current version, it's not package, node or OS specific.

Additional context

None.

[BUG] app doesn't work in glitch (likely doesn't work anywhere) - README missing additional scope needed

Describe the bug

README missing additional scope needed.

Requirements (place an x in each of the [ ])**

  • [ x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x ] I've read and agree to the Code of Conduct.
  • [x ] I've searched for any related issues and avoided creating a duplicate issue.

To Reproduce

Steps to reproduce the behavior:
Create a channel called - test.
Create a channel called test-001 - nothing
Rename channel to test-002 - nothing
Create channel foo-bar - nothing.
Errors show up in glitch logs as
{ ok: false, error: 'not_in_channel' }

Expected behavior

Interactive item about channels not having templates, being added to templates, changes to the templates.json on disk.

Screenshots

If applicable, add screenshots to help explain your problem.

Reproducible in:

package version:
node version:
OS version(s):

Additional context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.