This bot executes the slack slash command to search for images.
This bot runs as a web app within a Google app script.
You can make this bot work by registering it as a request URL for the Slack API slash command.
npm
- clasp
npm install -g @google/clasp
make
To use it, you need to set up Google apps scripts, Custom Search API and Slack API.
- Enable Google Apps Script API
https://script.google.com/home/usersettings - make push
- make deploy
- Grant the necessary privileges
make open
Publish > Deploy as web app.. > Update
Grant access
- Create New App
https://api.slack.com/apps
Please make a note ofApp Credentials
displayed after registration.
In order to run the application and change its behavior, you need to set the following Google Apps scripts property.
Property name | Required | Setting Value | Description |
---|---|---|---|
VERIFICATION_TOKEN | ○ | Basic Information > App Credentials > Verification Token | A token that easily authenticates the source of a hooked request |
GOOGLE_API_KEY | ○ | Create Credentials | |
CUSTOM_SEARCH_ENGINE_ID | ○ | Enabling the Custom Search API. Getting the Custom Search Engine (CSE) | |
OVERUSE_MESSAGE | default :anger: Search too much.. |
- Open Project
$ make open
- Add Scirpt properties
File > Project properties > Scirpt properties > Add row
Setting Property & Value
-
Create New Command
Setting Request URL. ex) https://script.google.com/macros/s/miserarenaiyo/exec -
Slack APP install Settings > Install App