Skip to content
This repository was archived by the owner on Jul 5, 2026. It is now read-only.

Latest commit

 

History

History
74 lines (61 loc) · 2.3 KB

File metadata and controls

74 lines (61 loc) · 2.3 KB

🤖 Slack Reply Bot

It is a serverless BOT which receives Slack's public channel message and reply if there includes a specific keyword.

DEMO:

demo

Description

Using Slack's BOT and Subscribe to receive all the public messages toward Lambda via API-Gateway. If there includes a specific keyword, call the Slack API and send a message back to the same channel. Slack BOT needs to be create manually, but AWS side automates environment construction by using Serverless Framework.

Requirement

Installation

  1. Create Slack BOT from Here

    • Bot User
      • Display Name
      • Default Username
    • Permissions
      • OAuth & Permissions
        • Scopes
          • channels:history
          • channels:write
  2. Get two tokens

    • Permissions
      • OAuth & Permissions
        • OAuth Access Token
        • Bot User OAuth Access Token
  3. Clone this repo.

$ git clone https://github.com/saitota/SlackReplyBot.git
  1. Modify environment_dev.yml 's two TOKENs to your token.
OAUTH_TOKEN: 'xoxp-000000000000-000000000000-000000000000-0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x'
BOT_TOKEN: 'xoxb-000000000000-0x0x0x0x0x0x0x'
  1. Deploy with Serverless Framework (you must aws-cli initialize before)
$ sls deploy
...
api keys:
  None
endpoints:
  POST - https://0x0x0x0x0x.execute-api.ap-northeast-1.amazonaws.com/dev/
functions:
  fnc: SlackReplyBot-dev-fnc
  1. Set Slack BOT endpoint and event subscribe settings

    • Event Subscriptions
      • Request URL: set your endopint url(you can see in your deploy log)
    • Subscribe to Workspace Events
      • message.channels
  2. Done! try to say poop at Slack.

🤔 Anything Else

I wrote article about this BOT.

Slack で自動返信するサーバレスBOTを作りました - Qiita

🐑 Author

saitotak

✍ License

MIT