This instructions' guide will give your application permission to make a copy of the post-mortem doc template in your Google Drive whenever a new incident is started.
- Official documentation
- Get a Client ID and Client Secret
- Google Drive API
- Google Calendar API
- Setting environment variables
The instructions here are a summary of the official documentation.
- Open the Google API Console Credentials page.
- From the project drop-down menu, select an existing project or create a new one.
- On the OAuth consent screen page, select an User Type, then click Create.
- Give a name for it and save it.
- On the Credentials page, select Create credentials, then select OAuth client ID.
- Under Application type, choose Desktop app and give it a name, ie. Hellper. Then, click Create.
- On this next page, take note of the Client ID and Client Secret. You'll need these going forward. Then, click Ok.
- At last, click in the Download icon button to configure your credentials.
- Copy the content file and paste it in your environment variable called:
HELLPER_GOOGLE_CREDENTIALS
.
- Copy the Client ID you got in the last step (Credentials).
- In the following URL, change
YOUR_CLIENT_ID_HERE
with the content from Client ID:
https://accounts.google.com/o/oauth2/v2/auth?client_id=YOUR_CLIENT_ID_HERE&response_type=code&scope=https://www.googleapis.com/auth/drive&access_type=offline&redirect_uri=urn:ietf:wg:oauth:2.0:oob
- Access the new URL in your web browser.
- Allow the permissions to your application to be able to access yours files.
- On this next page, take note of the Code. You'll need this going forward.
- Now you need to copy the Client ID, Client Secret and Code of the last steps (Credentials and Authorizing requests to the Google Drive API), and replace them respectively in the follow command:
curl --data client_id="YOUR_CLIENT_ID_HERE" \
--data client_secret="YOUR_CLIENT_SECRET_HERE" \
--data code="YOUR_AUTH_CODE_HERE" \
--data redirect_uri=urn:ietf:wg:oauth:2.0:oob \
--data grant_type=authorization_code \
https://oauth2.googleapis.com/token
- Run it in your terminal and copy the response.
- Past it in your environment variable called:
HELLPER_GOOGLE_DRIVE_TOKEN
.
Run it in terminal
curl --data client_id="YOUR_CLIENT_ID" \
--data client_secret="YOUR_CLIENT_SECRET" \
--data code="YOUR_AUTH_CODE" \
--data redirect_uri=urn:ietf:wg:oauth:2.0:oob \
--data grant_type=authorization_code \
https://oauth2.googleapis.com/token
Response
{
"access_token": "xxxxxxxxxxxxxxxxxx",
"expires_in": 3599,
"refresh_token": "xxxxxxxxxxxxxxxxxx",
"scope": "https://www.googleapis.com/auth/drive",
"token_type": "Bearer"
}
Access API Library, then click Enable.
- Create new a file in your Google Doc and copy the ID from the file, like this:
https://docs.google.com/document/d/YOUR_FILE_ID_IS_HERE/edit
- Paste the ID in your environment variable called:
HELLPER_GOOGLE_DRIVE_FILE_ID
.
- Copy the Client ID you got in the last step (Credentials).
- In the following URL, change
YOUR_CLIENT_ID_HERE
with the content from Client ID:
https://accounts.google.com/o/oauth2/v2/auth?client_id=YOUR_CLIENT_ID_HERE&response_type=code&scope=https://www.googleapis.com/auth/calendar&access_type=offline&redirect_uri=urn:ietf:wg:oauth:2.0:oob
- Access the new URL in your web browser.
- Allow the permissions to your application to be able to access your files.
- On this next page, take note of the Code. You'll need this going forward.
- Now you need to copy the Client ID, Client Secret and Code of the last steps (Credentials and Authorizing requests to the Google Calendar API)), and replace them respectively in the follow command:
curl --data client_id="YOUR_CLIENT_ID_HERE" \
--data client_secret="YOUR_CLIENT_SECRET_HERE" \
--data code="YOUR_AUTH_CODE_HERE" \
--data redirect_uri=urn:ietf:wg:oauth:2.0:oob \
--data grant_type=authorization_code \
https://oauth2.googleapis.com/token
- Run it in your terminal and copy the response.
- Past it in your environment variable called:
HELLPER_GOOGLE_CALENDAR_TOKEN
.
Run it in terminal
curl --data client_id="YOUR_CLIENT_ID" \
--data client_secret="YOUR_CLIENT_SECRET" \
--data code="YOUR_AUTH_CODE" \
--data redirect_uri=urn:ietf:wg:oauth:2.0:oob \
--data grant_type=authorization_code \
https://oauth2.googleapis.com/token
Response
{
"access_token": "xxxxxxxxxxxxxxxxxx",
"expires_in": 3599,
"refresh_token": "xxxxxxxxxxxxxxxxxx",
"scope": "https://www.googleapis.com/auth/calendar",
"token_type": "Bearer"
}
Access API Library, then click Enable.
If you don't need to create a new google calendar go to step 6, otherwise follow the instructions below.
- On your computer, open Google Calendar
- On the left, next to Other calendars click Add other calendars
- Click Create new calendar
- Add a name and description for your calendar
- Click Create calendar
- In the Google Calendar interface, locate the My calendars area on the left
- Hover over the calendar you need and click the downward arrow
- A menu will appear. Click Calendar settings
- In the Calendar Address section of the screen, you will see your Calendar ID. It will look something like:
[email protected]
- Paste the ID in your environment variable called:
HELLPER_GOOGLE_CALENDAR_ID
Now you need to change these three variables:
Variable | Explanation |
---|---|
HELLPER_GOOGLE_CREDENTIALS | Google Credentials |
HELLPER_GOOGLE_DRIVE_TOKEN | Google Drive Token |
HELLPER_GOOGLE_DRIVE_FILE_ID | Google Drive File Id to your post-mortem template |
HELLPER_GOOGLE_CALENDAR_TOKEN | Google Calendar Token |
HELLPER_GOOGLE_CALENDAR_ID | Google Calendar Id to schedule your post-mortem |