Skip to content

It's a serverless BOT which receives Slack's Public Channel message and reply if there includes a specific keyword.

License

Notifications You must be signed in to change notification settings

saitota/SlackReplyBot

Repository files navigation

🤖 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

About

It's a serverless BOT which receives Slack's Public Channel message and reply if there includes a specific keyword.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages