通过slack中的斜杠命令执行trello操作
slack_to_trello的Python项目详细描述
通过slack中的斜杠命令执行trello操作
当前迭代是概念的证明;目前只支持1个slack团队、1个trello用户和1个trello列表。将来,我们希望通过与trello的oauth集成(将slack用户连接到trello用户)和一些选择板的机制(从slack或服务器上的映射)来支持多个团队和板。
转换
进入
开始
要获得slack-to-trello运行的副本,请执行以下步骤:
# Clone our repository git clone https://github.com/underdogio/slack-to-trello cd slack-to-trello/ # Install our dependencies pip install -r requirements.txt # Install our module as a dependency of itself (meta) python setup.py develop # The remaining steps are for setting up our configuration # We will be building `slack_to_trello/config/env` # We start by copying `env.test` cp slack_to_trello/config/env.test slack_to_trello/config/env # Create 2 Slack integrations (1 for receiving slash commands, 1 for sending messages) # First Slack integration: Slash Commands # Open your browser to Slash Commands # https://my.slack.com/services/new/slash-commands # Command: "/trello" # URL: "https://my-server/slack/message" # Please replace `my-server` with your server location # Don't forget to host it on HTTPS # Method: "POST" # Token: Provided by Slack # Autocomplete -> Description: "Add a Trello card on the Engineering board" # Autocomplete -> Help text: "[card subject]" # Descriptive Label: "slack-to-trello" # Click "Save Integration" # Once saved, add the "Token" field as `SLACK_TOKEN` into `env` # `export SLACK_TOKEN=token_from_slack` # Second Slack integration: Incoming WebHooks # These will be replies upon successful Trello card additions # Open your browser to Incoming WebHooks # https://my.slack.com/services/new/incoming-webhook # Post to Channel: Pick any channel -- we will always be overriding this # Webhook URL: Provided by Slack # Descriptive Label: "slack-to-trello messages" # Customize Name: "slack-to-trello" # Customize Icon: Pick any you like -- we recommend `:signal_strength:` # Click "Save Settings" # Once saved, add the "Webhook URL" field as `SLACK_MESSAGE_URL` into `env` # `export SLACK_MESSAGE_URL=https://hooks.slack.com/services/path/to/reply` # Set up our Trello integration # We recommend creating a bot user as all cards # will be marked as "Created by" the chosen user # Collect our Trello API information # Open our browser to https://trello.com/app-key # Save "Key" as `TRELLO_API_KEY` in `env` # `export TRELLO_API_KEY=value_from_key` # Generate a permanent Trello API token (this can be disabled later on) # Using the "Key" as "TRELLO_API_KEY" and "Secret" as "TRELLO_API_SECRET" TRELLO_API_KEY=key_from_website TRELLO_API_SECRET=secret_from_website bin/generate-trello-tokens.py # You will be prompted to open a link # Follow the link and click "Accept" # Copy the standalone value from the page # Go back to the command line and enter "y" # You will be prompted for a PIN # Paste the value from the page # You will be given an `oauth_token` and `oauth_token_secret` value # Save `oauth_token` as `TRELLO_TOKEN` in `env` # `export TRELLO_TOKEN=value_from_oauth_token` # Find the board/list we want to add cards to # List our boards and their ids via: bin/list-trello-boards.py [TRELLO_API_KEY][TRELLO_TOKEN]# Find the board we want and record its id as `TRELLO_BOARD_ID` in `env` # `export TRELLO_BOARD_ID=target_board_id` # Output the board lists and their ids via: bin/list-trello-board-lists.py [TRELLO_API_KEY][TRELLO_TOKEN][TRELLO_BOARD_ID]# Find the list we want and record its id as `TRELLO_LIST_ID` in `env` # `export TRELLO_LIST_ID=target_board_id` # Start our server (default port is 5000) ./run.sh # An alternative port can be chosen via the `PORT` environment variable # PORT=6000 ./run.sh # You should now be able to send a `/trello` command in Slack
文档
测试
我们的测试是通过nosetests支持的,但是需要在手动操作之前设置特定的环境变量。要运行我们的测试,请执行以下步骤:
# Install our development dependencies pip install -r requirements-dev.txt # Run our tests ./test.sh
贡献
代替正式的形式指南,注意保持现有的编码风格。为任何新的或更改的功能添加单元测试。通过./test.sh进行测试。
许可证
版权所有(c)2015 underdog.io
根据麻省理工学院的许可证。