Slack の特定のチャンネルへ post されたスライド(pdf)を取得し、Google Drive へ保存しスプレッドシートへ書き込む Bot です。
また、スプレッドシートに保存した内容を全件取得するエンドポイントが存在するため他サービスと連携可能です。
- Node.js v8 or more
- clasp
$ git clone https://github.com/euglena1215/slide-uploader-for-slack.git
$ cd slide-uploader-for-slack
$ yarn intall
- Install the clasp.
$ yarn global add @google/clasp
- Login with your google account.
$ clasp login
- Create new Google Apps Script.
$ clasp create slide-uploader-for-slack --rootDir ./dist
- Create SpreadSheet
Create new sheet and Rename [Sheet1] -> [pdfFiles]. And Fill [fileId, pdfUrl, imgUrl, uploadUser, timestamp] to A1:E1 cells.
- Open script file from browser.
$ clasp open
- Select [File] -> [Script Property], and Add the following property.
SLACK_API_TOKEN | SPREADSHEET_URL | DRIVE_FOLDER_ID | SLACK_TARGET_CHANNEL |
---|---|---|---|
Getting here | Copy URL of 1. Create SpreadSheet | Create new Folder and Copy https://drive.google.com/drive/u/0/folders/DRIVE_FOLDER_ID |
Open target channel and Copy Link anything post like https://hoge-team.slack.com/archives/SLACK_TARGET_CHANNEL/p1543071858000200 . |
- Open script file from browser.
$ clasp open
- Set trigger
Select [Edit] -> [All trigger], set trigger to main
fuction by time base(Recommend per 30 minutes).
$ yarn build
$ yarn push
If you want to use watch mode, run the next command.
$ yarn watch
In this watch mode, the build file is automatically pushed when chaging the contents in the src
folder.