Google Cloud is an organization producing 2 well-know product groups, GCP & G Suite. Most think they don't go nor work well together. This 90-minute session busts that myth and exposes developers to some of the more well-known APIs from both GCP & G Suite as well as highlights several novel solutions that have already been built as sample apps but also serve as inspiration into what's possible. The goal is to show developers the potential of building with ALL of Google Cloud.
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Build with ALL of Google Cloud
1. Build with all of
Google Cloud
Wesley Chun
Developer Advocate, Google
G Suite Dev Show
goo.gl/JpBQ40
About the speaker
● Developer Advocate, Google Cloud
● Mission: enable current and future developers to be successful using
Google Cloud and other Google developer tools, APIs, and platforms
● Videos: host of the G Suite Dev Show on YouTube
● Blogs: developers.googleblog.com &
gsuite-developers.googleblog.com
● Twitters: @wescpy, @GCPcloud, @GoogleDevs, @GSuiteDevs
● Background
● Software engineer & architect for 20+ years
● One of the original Yahoo!Mail engineers
● Author of bestselling "Core Python" books (corepython.com)
● Teacher and technical instructor since 1983 (all ages)
● Fellow of the Python Software Foundation
● AB Mathematics & CMP Music, UC Berkeley; MSCS UC Santa Barbara
3. What is cloud computing?
spar
Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
Cloud service levels/"pillars"
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Apps Script, App Maker
Salesforce1/force.com
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
4. Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
Outsourcing of apps (SaaS)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Apps Script, App Maker
Salesforce1/force.com
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
Outsourcing of hardware (IaaS)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Apps Script, App Maker
Salesforce1/force.com
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
5. Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
Outsourcing of logic-hosting (PaaS)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Apps Script, App Maker
Salesforce1/force.com
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
IaaS/PaaS gray area (DataB/S/P-aaS?)
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google Apps Script, App Maker
Salesforce1/force.com
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
6. Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
SaaS/PaaS gray area
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google Apps Script, App Maker
Salesforce1/force.com
Summary of responsibility
SaaS
Software as a Service
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
IaaS
Infrastructure as a Service
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
PaaS
Platform as a Service
Managed by YOU Managed by cloud vendor
Applications
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
on-prem
all you, no cloud
8. G Suite APIs
Top-level documentation and comprehensive developers
overview video at developers.google.com/gsuite
Google Compute Engine, Google Cloud Storage
AWS EC2 & S3; Rackspace; Joyent
SaaS
Software as a Service
PaaS
Platform as a Service
IaaS
Infrastructure as a Service
Google Apps Script, App Maker
Salesforce1/force.com
G Suite (Google Apps)
Yahoo!Mail, Hotmail, Salesforce, Netsuite
Google App Engine, Cloud Functions
Heroku, Cloud Foundry, Engine Yard, AWS Lambda
Google BigQuery, Cloud SQL,
Cloud Datastore, NL, Vision, Pub/Sub
AWS Kinesis, RDS; Windows Azure SQL, Docker
Google Cloud Platform vs. G Suite
G Suite
APIs
GCP
APIs
9. Billing primer
● Service & API usage: pay-per-use
● Must exceed "Always Free" usage tier
○ … to incur billing
● Payment instrument required
○ CC, free trial, education grant
● cloud.google.com/{pricing,free}
● Monthly subscription (fee)
○ Consumer Gmail: fee = $0
○ Covers service & API usage
● Similar "always free" usage tier but
○ Fixed… cannot exceed this
quota
● gsuite.google.com/pricing.html
● developers.google.com/apps-script/
guides/services/quotas
Compute
(running code)
10. Running Code: Compute Engine
>
Google Compute Engine
cloud
Running Code: App Engine
Google App Engine
we
>
cloud
11. Running Code: Cloud Functions
Google Cloud Functions
cloud
firebase
Running Code: Cloud Run
Google Cloud Run
cloud
12. Storage
(where to put your data)
Storing Data: Cloud Storage & Cloud Filestore
cloud
cloud
16. Machine Learning: Cloud Vision & Video Intelligence
Google Cloud Vision & Video
Intelligence APIs
cloud
cloud
Machine Learning: Cloud Natural Language
Google Cloud Natural Language API
cloud
18. Machine Learning: Cloud ML Engine
Google Cloud Machine Learning Engine
cloud
G Suite
(collaborate & communicate)
19. G Suite: Gmail
Gmail API
read &
send messages labels
search manage settings
developers
G Suite: Google Drive
Drive API read
write permissions/sharing
import/export
developers
20. G Suite: Google Calendar
Calendar API
access modify create
events
developers
G Suite: Google Sheets
Sheets API
developers
21. G Suite: Google Docs & Slides
Docs & Slides APIs
developers
developers
3
Getting started with API projects
& HTTP-based REST API examples
Short Python code snippets using GCP & G Suite APIs
API key (public data) vs. OAuth2 access (private data)
22. The first word on Security
Authentication ("authn") vs authorization ("authz")
● authn: you are who you say you are
○ login & passwd
○ handprint authentication
○ retina scan
● authz: okay, you are who you say you are, but can you haz data?
○ OAuth2 - mostly authz, but some authn
○ Mostly about 3rd-party access to data
○ Users must give YOUR code access to THEIR data
○ Most of the time when you see "auth", it refers to authz
● Some refer to this as "consent" vs. "credentials…" which is which?
Cloud/GCP console
console.cloud.google.com
● Hub of all developer activity
● Applications == projects
○ New project for new apps
○ Projects have a billing acct
● Manage billing accounts
○ Financial instrument required
○ Personal or corporate credit cards,
Free Trial, and education grants
● Access GCP product settings
● Manage users & security
● Manage APIs in devconsole
23. ● View application statistics
● En-/disable Google APIs
● Obtain application credentials
Using Google APIs
goo.gl/RbyTFD
API manager aka Developers Console (devconsole)
console.developers.google.com
&
Google APIs client
libraries for many
languages; demos in
developers.google.com/
api-client-library
24. SIMPLE
AUTHORIZED
Which do you choose?
OAuth2 or
API key
HTTP-based REST APIs 1
HTTP
2
Google APIs request-response workflow
● Application makes request
● Request received by service
● Process data, return response
● Results sent to application
(typical client-server model)
25. List (first 100) files/folders in Google Drive
from __future__ import print_function
from googleapiclient import discovery
from httplib2 import Http
from oauth2client import file, client, tools
SCOPES = 'https://www.googleapis.com/auth/drive.metadata.readonly'
store = file.Storage('storage.json')
creds = store.get()
if not creds or creds.invalid:
flow = client.flow_from_clientsecrets('client_secret.json', SCOPES)
creds = tools.run_flow(flow, store)
DRIVE = discovery.build('drive', 'v3', http=creds.authorize(Http()))
files = DRIVE.files().list().execute().get('files', [])
for f in files:
print(f['name'], f['mimeType'])
Listing your files
goo.gl/ZIgf8k
List (first 100) files/folders in Google Drivefrom __future__ import print_function
import os.path
import pickle
from google.auth.transport.requests import Request
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient import discovery
creds = None
SCOPES = 'https://www.googleapis.com/auth/drive.metadata.readonly'
TOKENS = 'token.p' # where to store access & refresh tokens
if os.path.exists(TOKENS):
with open(TOKENS, 'rb') as token:
creds = pickle.load(token)
if not (creds and creds.valid):
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file('client_secret.json', SCOPES)
creds = flow.run_local_server()
with open(TOKENS, 'wb') as token:
pickle.dump(creds, token)
DRIVE = discovery.build('drive', 'v3', credentials=creds)
files = DRIVE.files().list().execute().get('files', [])
for f in files:
print(f['name'], f['mimeType'])
Listing your files
goo.gl/ZIgf8k
See developers.google.com/drive/api/v3/quickstart/python
26. Automate photo albums
OR
Try our Node.js customized reporting tool codelab:
g.co/codelabs/sheets
Why use the Sheets API?
data visualization
customized reports
Sheets as a data source
27. Migrate SQL data to a Sheet
# read SQL data then create new spreadsheet & add rows into it
FIELDS = ('ID', 'Customer Name', 'Product Code',
'Units Ordered', 'Unit Price', 'Status')
cxn = sqlite3.connect('db.sqlite')
cur = cxn.cursor()
rows = cur.execute('SELECT * FROM orders').fetchall()
cxn.close()
rows.insert(0, FIELDS)
DATA = {'properties': {'title': 'Customer orders'}}
SHEET_ID = SHEETS.spreadsheets().create(body=DATA,
fields='spreadsheetId').execute().get('spreadsheetId')
SHEETS.spreadsheets().values().update(spreadsheetId=SHEET_ID, range='A1',
body={'values': rows}, valueInputOption='RAW').execute()
Migrate SQL data
to Sheets
goo.gl/N1RPwC
Try our Node.js BigQuery GitHub license analyzer codelab:
g.co/codelabs/slides
Why use the Slides API?
data visualization
presentable reports
28. Try our Node.js Markdown-to-Google-Slides generator:
github.com/gsuitedevs/md2googleslides
Why use the Slides API?
customized presentations
Replace text & images from template deck
requests = [
# (global) search-and-replace text
{'replaceAllText': {
'findText': '{{TITLE}}',
'replaceText': 'Hello World!',
}},
# replace text-based image placeholders (global)
{'replaceAllShapesWithImage': {
'imageUrl': IMG_URL, # link to product logo
'replaceMethod': 'CENTER_INSIDE',
'containsText': {'text': '{{LOGO}}'},
}},
]
SLIDES.presentations().batchUpdate(body={'requests': requests},
presentationId=DECK_ID, fields='').execute()
Replacing text
and images
goo.gl/o6EFwk
29. +
Mail merge
=
Mail merge (template search & replace)
requests = [
# (global) search-and-replace text
{'replaceAllText': {
'containsText': {'text': '{{TITLE}}'},
'replaceText': 'Hello World!',
}},
]
DOCS.documents().batchUpdate(body={'requests': requests},
documentId=DOC_ID, fields='').execute()
Mail merge
goo.gle/2KrPNeG
30. Display Gmail threads (& # of messages)
# get all "busy" mail threads & display (non-blank) Subject lines
threads = GMAIL.users().threads().list(userId='me',
fields='threads').execute().get('threads', [])
for thread in threads:
tdata = GMAIL.users().threads().get(userId='me', id=thread['id'],
format='metadata', metadataHeaders=['subject'],
fields='messages/payload/headers(name,value)').execute()
if 'messages' not in tdata:
continue
if len(tdata['messages']) > 10:
msg = tdata['messages'][0]['payload']
subject = ''
for header in msg['headers']:
if header['name'] == 'Subject':
subject = header['value']
break
if subject:
print('%2d message(s) in thread: %s' % (
len(tdata['messages']), subject))
Gmail threads
goo.gl/pFYUQ2
Creating events in Calendar
# define event data, then create event
TIMEZONE = 'America/Los_Angeles'
EVENT = {
'summary': 'Dinner with friends',
'start': {'dateTime': '2017-06-14T19:00:00', 'timeZone': TIMEZONE},
'end': {'dateTime': '2017-06-14T22:00:00', 'timeZone': TIMEZONE},
'attendees': [
{'email': 'friend1@example.com'},
{'email': 'friend2@example.com'},
],
}
GCAL.events().insert(calendarId='primary', body=EVENT,
sendNotifications=True, fields='').execute()
Modifying and
recurring events
goo.gl/J2XkXc
Creating events
goo.gl/KuYMiq
31. BigQuery: querying Shakespeare words
TITLE = "The top 10 most common words in all of Shakespeare's works"
QUERY = '''
SELECT LOWER(word) AS word, sum(word_count) AS count
FROM [bigquery-public-data:samples.shakespeare]
GROUP BY word ORDER BY count DESC LIMIT 10
'''
rsp = BQ.query(body={'query': QUERY}, projectId=PROJ_ID).execute()
print('n*** Results for %r:n' % TITLE)
for col in rsp['schema']['fields']: # HEADERS
print(col['name'].upper(), end='t')
print()
for row in rsp['rows']: # DATA
for col in row['f']:
print(col['v'], end='t')
print()
Top 10 most common Shakespeare words
$ python bq_shake.py
*** Results for "The most common words in all of Shakespeare's works":
WORD COUNT
the 29801
and 27529
i 21029
to 20957
of 18514
a 15370
you 14010
my 12936
in 11722
that 11519
32. labeling = VISION.images().annotate(body=body).execute().get('responses')
for labels in labeling:
if 'labelAnnotations' in labels:
print('** Labels detected (and confidence score):')
for label in labels['labelAnnotations']:
print(('%.2f%%' % (
label['score']*100.)).ljust(10), label['description'])
if 'faceAnnotations' in labels:
print('n** Facial features detected (and likelihood):')
for label, value in labels['faceAnnotations'][0].items():
if label.endswith('Likelihood'):
print(label.split('Likelihood')[0].ljust(16),
value.lower().replace('_', ' '))
Vision: image analysis & metadata extraction
$ python viz_demo.py
** Labels detected (and confidence score):
89.94% Sitting
86.09% Interior design
82.08% Furniture
81.52% Table
80.85% Room
79.04% White-collar worker
76.19% Office
68.18% Conversation
60.96% Window
60.07% Desk
** Facial features detected (and likelihood):
anger very unlikely
joy very likely
underExposed very unlikely
sorrow very unlikely
surprise very unlikely
headwear very unlikely
blurred very unlikely
Vision: image analysis & metadata extraction
33. Simple sentiment & classification analysis
TEXT = '''Google, headquartered in Mountain View, unveiled the new
Android phone at the Consumer Electronics Show. Sundar Pichai said
in his keynote that users love their new Android phones.'''
print('TEXT:', TEXT)
data = {'type': 'PLAIN_TEXT', 'content': TEXT}
NL = discovery.build('language', 'v1', developerKey=API_KEY)
# sentiment analysis
sent = NL.documents().analyzeSentiment(
body={'document': data}).execute().get('documentSentiment')
print('nSENTIMENT: score (%s), magnitude (%s)' % (sent['score'], sent['magnitude']))
# content classification
print('nCATEGORIES:')
cats = NL.documents().classifyText(body={'document': data}).execute().get('categories')
for cat in cats:
print('* %s (%s)' % (cat['name'][1:], cat['confidence']))
Simple sentiment & classification analysis
$ python nl_sent_simple.py
TEXT: Google, headquartered in Mountain View, unveiled the new Android
phone at the Consumer Electronics Show. Sundar Pichai said in
his keynote that users love their new Android phones.
SENTIMENT: score (0.3), magnitude (0.6)
CATEGORIES:
* Internet & Telecom (0.76)
* Computers & Electronics (0.64)
* News (0.56)
34. 4
Run your code on
Google Cloud serverless
GCP: Google App Engine , Google Cloud Functions
G Suite: Google Apps Script , Google App Maker
Serverless: what & why
● What is serverless?
○ Misnomer
○ "No worries"
○ Developers focus on writing code & solving business problems*
● Why serverless?
○ Fastest growing segment of cloud... per analyst research*:
■ $1.9B (2016) and $4.25B (2018) ⇒ $7.7B (2021) and $14.93B (2023)
○ What if you go viral? Autoscaling: your new best friend
○ What if you don't? Code not running? You're not paying.
* in USD; source:Forbes (May 2018), MarketsandMarkets™ & CB Insights (Aug 2018)
36. App Engine to the rescue!!
● Focus on app not DevOps
● Enhance productivity
● Deploy globally
● Fully-managed
● Auto-scaling
● Pay-per-use
● Familiar standard runtimes
● 2nd gen std platforms
○ Python 3.7
○ Java 8, 11
○ PHP 7.2
○ Go 1.11
○ JS/Node.js 8, 10
○ Ruby 2.5
Hello World (3 files: Python "MVP")
app.yaml
runtime: python37
main.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
requirements.txt
Flask==1.0.2
Deploy:
$ gcloud app deploy
Access globally:
https://PROJECT_ID.appspot.com
Open source repo at
github.com/GoogleCloudPlatform/python-docs-samples/
tree/master/appengine/standard_python37/hello_world
37. Google Cloud Functions
Function-hosting in the cloud
Why does Cloud Functions exist?
● Don't have entire app?
○ No framework "overhead" (LAMP, MEAN...)
○ Deploy microservices
● Event-driven
○ Triggered via HTTP or background events
■ Pub/Sub, Cloud Storage, Firebase, etc.
○ Auto-scaling & highly-available; pay per use
● Flexible development environment
○ Cmd-line or developer console
● Cloud Functions for Firebase
○ Mobile app use-cases
● Available runtimes
○ JS/Node.js 6, 8, 10
○ Python 3.7
○ Go 1.11, 1.12
○ Java 8
38. main.py
def hello_world(request):
return 'Hello World!'
Deploy:
$ gcloud functions deploy hello --runtime python37 --trigger-http
Access globally (curl):
curl -X POST https://GCP_REGION-PROJECT_ID.cloudfunctions.net/hello
-H "Content-Type:application/json"
Access globally (browser):
GCP_REGION-PROJECT_ID.cloudfunctions.net/hello
Hello World (Python "MVP")
No cmd-line
access?
Use in-browser
dev environment!
● setup
● code
● deploy
● test
39. Google Apps Script (and App Maker)
Customized JS runtime for automation, extension, and integration
with G Suite and other Google or external services
+JavaScript
-API “flavor”
+built-in
“flavor”
-OAuth2 (you)
!=
40. Google Apps Script is a serverless
JavaScript runtime for automation,
extension, and integration with G Suite,
Google, or other external services.
“
”
Spreadsheets… any magic functions?
41. Sure, how about GOOGLEFINANCE()?
Spreadsheets… can you code them?
42. Sure, if you know where to look...
“Hello World!” in Apps Script
46. Accessing maps from
spreadsheets?!?
goo.gl/oAzBN9
This… with help from Google Maps & Gmail
function sendMap() {
var sheet = SpreadsheetApp.getActiveSheet();
var address = sheet.getRange("A2").getValue();
var map = Maps.newStaticMap().addMarker(address);
GmailApp.sendEmail('friend@example.com', 'Map',
'See below.', {attachments:[map]});
}
JS
47. ● Extend functionality of G Suite editors
● Embed your app within ours!
● 2014: Google Docs, Sheets, Forms
● 2017 Q3: Google Slides
● 2017 Q4: Gmail
● 2018 Q1: Hangouts Chat bots
● Apps Script also powers App Maker,
Google Data Studio community
connectors, and Google Ads scripts
Apps Script powers add-ons… and more!
Expense
reports...
● Expense reports
● Can't we do them
without leaving Gmail?
● On Web AND mobile?
48. ● At your desk or on the road
● One place to complete
your expense report
● One code base
Gmail Add-ons
Expediting expense
reports
goo.gl/KUVCDu
● Command-line interface
● Intergrate with git plus
your local IDE/dev env.
● Actions
○ Create
○ Pull
○ Push
○ Clone
○ Deploy
○ View logs
● Built on Apps Script API
● Launched early 2018
Professional workflow with clasp tool
49. ● Low-code assistive development
environment; Cloud SQL default
● Go from idea to app in minutes
● Drag-n-drop app building
● Many pre-made template apps
● Generates Apps Script code
● Requires at least G Suite Business
Google App Maker
developers.google.com/appmaker
All of Cloud (inspiration)
Build powerful solutions with both GCP and G Suite5
51. Gmail message processing with GCP
Gmail
Cloud
Pub/Sub
Cloud
Functions
Cloud
Vision
G Suite GCP
Star
message
Message
notification
Trigger
function
Extract
images
Categorize
images
Inbox augmented with Cloud Function
52. ● Gmail API: sets up notification forwarding to Cloud Pub/Sub
● developers.google.com/gmail/api/guides/push
● Pub/Sub: triggers logic hosted by Cloud Functions
● cloud.google.com/functions/docs/calling/pubsub
● Cloud Functions: "orchestrator" accessing GCP APIs
● Combine all of the above to add custom intelligence to Gmail
● Deep dive code blog post
● cloud.google.com/blog/products/application-development/
adding-custom-intelligence-to-gmail-with-serverless-on-gcp
● Application source code
● github.com/GoogleCloudPlatform/cloud-functions-gmail-nodejs
App summary
Big data analysis to slide presentation
Access GCP tools from G Suite
56. Supercharge G Suite with GCP
G Suite GCP
BigQuery
Apps Script
Slides Sheets
Application
request
Big data
analytics
App summary
● Leverage GCP and build the "final mile" with G Suite
● Driven by Google Apps Script
● Google BigQuery for data analysis
● Google Sheets for visualization
● Google Slides for presentable results
● "Glued" together w/G Suite serverless
● Build this app (codelab)
● g.co/codelabs/bigquery-sheets-slides
● Video and blog post
● bit.ly/2OcptaG
● Application source code
● github.com/googlecodelabs/bigquery-sheets-slides
● Presented at Google Cloud NEXT (Jul 2018 [DEV229] & Apr 2019 [DEV212])
● cloud.withgoogle.com/next18/sf/sessions/session/156878
● cloud.withgoogle.com/next/sf/sessions?session=DEV212
57. Hangouts Chat Productivity Tracker
Chat bot that's GCP & G Suite aware
Productivity tracker Hangouts Chat bot
G Suite GCP
Sheets Natural Language
START
or LOG
END
Hangouts
Chat
App
Engine
Cloud
SQL
58. App summary
● Motivation
● Do coding contract jobs during school year
● Needed to track time spent on work (and non-work)
● Who doesn't want to be more productive?
● Hangouts Chat bot framework & API... build bots to:
● Automate workflows
● Query for information
● Other heavy-lifting
● G Suite app that leverages app-hosting, NL processing, and storage tools from GCP
● Application source code
● github.com/gsuitedevs/hangouts-chat-samples/tree/master/python/productivity_tracker
● Presented at GDG Silicon Valley (Aug 2018)
● meetup.com/gdg-silicon-valley/events/252858660
59. Using Google Docs as an IDE
Running Python code in Docs w/the help of GCP
Google Docs as a Code Editor/IDE
GCP G Suite
Docs
New Roster,
New Editors
Run Code
Edit Roster
Edit Code
Cloud
Functions
Compute
Engine
Drive
Sheets
New Roster,
New Editors
60. App summary
● Motivation
● Lead TA during school year; manage student coursework
● Needed roster app for non-engineering faculty for student coding
● Use two new products (Docs API and Python Cloud Functions)
● Implementation
● Use Drive & Sheets APIs to create student roster Sheet for professor
● Faculty completes roster in Sheet, calls Cloud Function again
● Autogenerate "Docs IDE" per student via Docs API
● Student edits code in Doc, then calls Cloud Function to run
● Read from Doc, spin-up GCE VM, run code, write results into Doc, bring down VM
● Application source code (to-be-published)
● github.com/gsuitedevs/python-samples/tree/master/docs/docs_editor
61. 6 Resources & summary
What's available for students & educators?
Session Summary
● Lots of tools with Google Cloud
○ G Suite for business applications, collaboration, communcation, productivity
○ GCP features: compute & storage, machine learning, networking, security, and more!
○ Both feature serverless platforms to simply development process
● Interoperability
○ It's a good thing
○ More choices and solutions
○ Right thing to do
● G Suite + GCP: powerful combination
○ Leverage strength of both platforms
○ Best of both worlds
● Solve challenges: your organization or your customers
62. References
● G Suite, Google Apps Script documentation & open source repos
○ developers.google.com/gsuite
○ developers.google.com/apps-script
○ github.com/gsuitedevs
● Google Cloud Platform (GCP) documentation & open source repos
○ cloud.google.com/gcp
○ cloud.google.com/docs
○ github.com/GoogleCloudPlatform/{python,nodejs}-docs-samples
○ Know AWS? Compare w/GCP at: cloud.google.com/docs/compare/aws
● Google APIs Client Libraries (G Suite & GCP) & Google Cloud SDK (GCP-only)
○ developers.google.com/api-client-library
○ cloud.google.com/sdk
More references
● Relevant videos
○ goo.gl/RbyTFD (new Google APIs project setup)
○ goo.gl/KMfbeK (common Python OAuth2 boilerplate code review)
○ goo.gl/ZIgf8k (APIs intro codelab [Drive API])
● Relevant codelabs
○ g.co/codelabs/gsuite-apis-intro (Drive API)
○ g.co/codelabs/apps-script-intro
○ codelabs.developers.google.com/codelabs/cloud-app-engine-python
○ codelabs.developers.google.com/codelabs/cloud-starting-cloudfunctions
● Inspirational apps
○ bit.ly/2OcptaG
○ cloud.google.com/blog/products/application-development/
adding-custom-intelligence-to-gmail-with-serverless-on-gcp
○ cloud.withgoogle.com/next/sf/sessions?session=DEV212
63. Learning resources
● Codelabs: self-paced, hands-on tutorials
○ Google codelabs: need a Gmail account, always free
■ g.co/codelabs/cloud
○ Qwiklabs codelabs: don't need a Gmail acct; typically not free
■ google.qwiklabs.com
■ Request free credits ("tokens") at cloud.google.com/edu
● Official GCP documentation
○ cloud.google.com/gcp/getting-started
○ Recommended: Getting Started, Cloud Console, Cloud Shell, Cloud SDK, Community
● YouTube video series:
○ youtube.com/GoogleCloud
○ Recommended: Cloud Minute shorts & Cloud NEXT videos
○ G Suite Dev Show: goo.gl/JpBQ40
Thank you! Questions?
Wesley Chun
@wescpy
Progress bars: goo.gl/69EJVw