npm install
% ./node_modules/gas-manager/bin/gas init
===================
Start gas-manager init
===================
This utility is will walk you through creating a gas-manager's config file.
Press ^C at any time to quit.
Do you have client_id & client_secret for Google OAuth2? [yes/no]
By following the instructions. It will create a file named gas-config.json
. Please locate it on the project root.
You don't need to create project setting. Please answer no
to below question.
Do you want to creating Project settings? [yes/no] no
Go to Google Apps Script and create new script and save as your favorite name.
If your script file name in the left pane is コード.gs
, please change it to main.gs
.
Then copy the file's ID from the URL and close the editor. https://script.google.com/a/georepublic.de/d/[FILE_ID]/edit?splash=yes
Then, create a development project config from gas-project.json
cp gas-project.json gas-project-dev.json
Replace fileId
field of gas-project-dev.json
with the FILE_ID
value.
Run below command
% make dev
It will deploy new Google Apps Script to the App script.
Please open the updated script and publish it as a web API. You can publish it from the menu > Publish > Deploy as Web App.
Access permission must be Anyone, even anonymous
.
Then, copy Current web app URL
.
After that, you have to run setUp
function once. It will create a Google Spreadsheed called Slack Timesheet
Go to Slack and add new integrations. (If you don't have a parmission, please ask.)
(Outgoing Webhook is obsolated, so latest script uses Event Subscribe)
- Go to Event Subscriptions of your App.
- Paste
Current web app URL
from the Apps Script into Request URL. - Add scope a
message.groups
for a private group,message.channels
for a public channel.
- Goto OAuth & Permissions page
- Copy
Bot User OAuth Access Token
- Open your Googl Apps Script and show
File -> Project Property
- Set copied access token as
SLACK_OAUTH_TOKEN
- Select your test channel
- Copy
Webhook URL
- Change your bot name
- Paste the URL to
Slack Incoming URL
cell on theSlack Timesheet
. - Add your bot name to the
無視するユーザ
.
Please say hi
on your test channel. The bot will create new record on the timesheet and reploy something.
That's All! Pull Requests are very welcome!
You can find additional inormation from Original Repos
When you update the Google Apps Script, you have to create new version for enabling the modification for the API.
- Run
make dev
and upload the new main.gs. - Open your Google Apps script
- Make a new version from
menu -> manage versions -> save new version
- Publish new version from
menu -> Publish -> Deploy as web app
and select the latest version.
Goto https://console.cloud.google.com/ and check if your Timesheet project is already exsisting. If no, please create a new project. Then copy project ID from the dashboard.
Open your Timesheet script, then set the project ID to the window from manu: select Resources -> Cloud Platform Projct
Go back to the GCP project page and enable BigQuery API if it is not enabled.
From GAS page, add BigQuery library.
Create new project and dataset from BigQuery console and copy the projectID and datasetID.
Set projectID and datasetID from the Google Script property from File -> Project Property menu.
Now you can push the data to the BigQuery. (At the first time, you will be asked to allow a permission to access BigQuery)
By default, this script will be fired every day 5 am.