项目作者: Thermondo

项目描述 :
Secret Santa slack bot for positive feedback.
高级语言: Python
项目地址: git://github.com/Thermondo/stanley.git
创建时间: 2018-02-23T10:19:27Z
项目社区:https://github.com/Thermondo/stanley

开源协议:Apache License 2.0

下载


Stanley

Stanley

A secret Santa Slack bot for positive feedback.

Setting up the bot

Just click the button, duh!

Deploy

You must configure on Heroku Scheduler
how often Stanley will ask for feedback. Our team is asking feedback on Mondays,
Wednesdays, and Fridays. It doesn’t mean that all team members will be asked three
times a week. Instead, Stanley will choose a sender and a receiver each day randomly.

Setting up Slack

  1. -> 'Start Building'
  2. ### 1. Add Bot
  3. In the section 'Add features and functionality' select Bots and fill the form
  4. ### 2. Permissions
  5. In the section 'Add features and functionality' select Permissions
  6. In the Scope add
  7. * bot
  8. * chat:write:bot
  9. * team:read
  10. ### 3. Event Subscriptions
  11. In the section 'Add features and functionality' select Event Subscriptions
  12. you have to set the deployed app url into 'Requests URL' and verify
  13. Next 'Subscribe to Bot Events' add 'message.im'
  14. Now go to your app and have fun!
  15. ### 4. Install your app to your workspace
  16. Until this moment you have a bot configure but not installed in your workspace yet.
  17. To do it and have access to Slack API credentials, click on _Install your app to your workspace_.
  18. ### 5. Set environment variables on Stanley
  19. * `SLACK_VERIFICATION_TOKEN`: Still on Slack, click on _Basic Information_ and
  20. in the section _App Credentials_ copy **Verification Token**.
  21. * `SLACK_API_TOKEN`: in the section _Install App_, copy it from _Bot User OAuth Access Token_.
  22. The variables `SLACK_API_TOKEN` and `SLACK_VERIFICATION_TOKEN` are required.
  23. Other environment variables that are optional:
  24. * `FEEDBACK_MEMBERS`: Stanley will use all members if you don't fill it in.
  25. You can get the users and their ids using [Request team members](#request-team-members) command
  26. * `REDIS_URL`: default is `redis://127.0.0.1:6379/0`
  27. * `SENTRY_DSN`: for Sentry integration purposes
  28. ## Helpful management commands
  29. ### Request team members
  30. To be able to see team members internal usernames (used in `FEEDBACK_MEMBERS` variable), you can run
  31. ```bash
  32. FLASK_APP=stanley/app.py flask team-command

It will give you the list of Slack team members with their IDs.

Request a feedback

To ask for a feedback, just run

  1. FLASK_APP=stanley/app.py flask request-feedback-command

This will ask a random person to provide a feedback to another random person.

Example of our command (that will run on Mondays, Wednesdays, and Fridays):

  1. if [ "$(date +%u)" = 1 ] || [ "$(date +%u)" = 3 ] || [ "$(date +%u)" = 5 ];
  2. then FLASK_APP=stanley/app.py flask request-feedback-command;
  3. fi