You are on page 1of 126

Friday, July 9, 2010

The Google Buzz API and You


Google DevFest Manila, July 5th 2010

Friday, July 9, 2010


Hello
Timothy Jordan
Developer Advocate, Google

buzz.timothyjordan.com
@timothyjordan

Friday, July 9, 2010


Hello
Bob Aman
Developer Programs Engineer, Google

buzz.sporkmonger.com
@sporkmonger

Friday, July 9, 2010


This talk

• Google Buzz & The Conversational Web

• Open Standards

• Google Buzz API

• Examples

• What’s next?

Friday, July 9, 2010


Google Buzz
...and the conversational web

Friday, July 9, 2010


Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Open Standards
...are a really good thing

Friday, July 9, 2010


Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Google Buzz API

Friday, July 9, 2010


Warning!

Friday, July 9, 2010


https://www.googleapis.com/buzz/v1/

Friday, July 9, 2010


https://www.googleapis.com/buzz/v1/

https://code.google.com/apis/buzz/docs/

Friday, July 9, 2010


https://www.googleapis.com/buzz/v1/

http://code.google.com/p/oacurl/

Friday, July 9, 2010


https://www.googleapis.com/buzz/v1/

http://code.google.com/p/buzz-php-client/

http://code.google.com/p/buzz-python-client/

http://code.google.com/p/buzz-java-client/

Friday, July 9, 2010


https://www.googleapis.com/buzz/v1/

alt
• alt=atom returns an Atom representation of the data.
• alt=json returns a JSON representation of the data.

prettyprint
• If prettyprint=true, the results returned by the server will be human readable
• Default: prettyprint=false

https://www.googleapis.com/buzz/v1/activities/@me/@self?alt=json&prettyprint=true

Friday, July 9, 2010


https://www.googleapis.com/buzz/v1/

• preview=true preview the operation.


• max-results=N maximum number of results.
• max-liked=N maximum number of likes
• max-comments=N maximum number of comments
• c={token} continuation token

https://www.googleapis.com/buzz/v1/activities/@me/@self?max-results=20&c={token}

Friday, July 9, 2010


https://www.googleapis.com/buzz/v1/

• q={query} search.
• lat, lon, radius geo location.
• bbox bounding box.

https://www.googleapis.com/buzz/v1/activities/search?q={q}&lat={l}&lon={l}&radius={r}

Friday, July 9, 2010


Activity Streams

Friday, July 9, 2010


Identity

Friday, July 9, 2010


Identity

Activities

Friday, July 9, 2010


Identity

Activities

Objects

Friday, July 9, 2010


Timothy

Shares

A Link

Friday, July 9, 2010


Barack Obama

Started Following

Timothy Jordan

Friday, July 9, 2010


Timothy Jordan

Started Following

Barack Obama

Friday, July 9, 2010


{
  "kind": "buzz#activity",
  "title": "note to self",
  "published": "2010-05-09T02:53:13.000Z",
  "updated": "2010-05-09T02:53:13.730Z",
   "id": "tag:google.com,2010:buzz:foo",
  "links": {
   "liked": [
    {
     "href": "https://www.googleapis.com/buzz/v1/activities/110242419133439594545/@self/tag:google.com,
2010:buzz:z13ispojgwqsinyij04chlupum2ytbspsa4/@liked?alt\u003djson",
     "type": "application/json",
     "count": 0
    }
   ],
   "alternate": [
    {
     "href": "http://www.google.com/buzz/a/google.com",
     "type": "text/html"
    }
   ],
   "self": [
    {
     "href": "https://www.googleapis.com/buzz/v1/activities/110242419133439594545/@self/tag:google.com,
2010:buzz:z13ispojgwqsinyij04chlupum2ytbspsa4?alt\u003djson",

Friday, July 9, 2010


{
  "kind": "buzz#activity",
  "title": "note to self",
  "published": "2010-05-09T02:53:13.000Z",
  "updated": "2010-05-09T02:53:13.730Z",
   "id": "tag:google.com,2010:buzz:foo",
  "links": {
   "liked": [
    {
     "href": "{url}/{userid}/@self/{commentId}/@liked?alt=json",
     "type": "application/json",
     "count": 4,
"updated": "2010-05-09T02:53:13.730Z"
    }
   ],
   "alternate": [
    {
     "href": "http://www.google.com/buzz/a/google.com",
     "type": "text/html"
    }
   ],
   "self": [
    {
     "href": "https://www.googleapis.com/buzz/v1/activities/110242419133439594545/@self/tag:google.com,
2010:buzz:z13ispojgwqsinyij04chlupum2ytbspsa4?alt\u003djson",
     "type": "json"

Friday, July 9, 2010


   "alternate": [
    {
     "href": "http://www.google.com/buzz/a/google.com",
     "type": "text/html"
    }
   ],
   "self": [
    {
     "href": "https://www.googleapis.com/buzz/v1/activities/110242419133439594545/@self/tag:google.com,
2010:buzz:z13ispojgwqsinyij04chlupum2ytbspsa4?alt\u003djson",
     "type": "json"
    }
   ],
"replies": [
   
    {
     "href": "{url}/{userId}/@self/{commentId}/@comments?alt=json",
     "type": "application/json",
     "count": 2,
     "updated": "2010-05-09T02:53:13.730Z"
    }
   ]
  },
  "actor": {
   "id": "110242419133439594545",
   "name": "Chris Chabot",
   "profileUrl": "http://www.google.com/profiles/a/google.com/110242419133439594545",
   "thumbnailUrl": ""
  },
  "verbs": [
   "post"
  ],
  "object": {

Friday, July 9, 2010


2010:buzz:z13ispojgwqsinyij04chlupum2ytbspsa4?alt\u003djson",
     "type": "json"
    }
   ],
   "replies": [
    {
     "href": "{url}/{userId}/@self/{commentId}/@comments?alt=json",
     "type": "application/json",
     "count": 2,
     "updated": "2010-05-09T02:53:13.730Z"
    }
   ]
  },
  "actor": {
   "id": "110242419133439594545",
   "name": "Chris Chabot",
   "profileUrl": "{url}/chabotc",
   "thumbnailUrl": "{url}/chabotc/thumb.jpg"
  },
  "verbs": [
   "post"
  ],
  "object": {
   "type": "note",
   "content": "content goes here",
   "links": {
    "alternate": [
     {
      "href": "http://www.google.com/buzz/a/google.com",
      "type": "text/html"
     }
    ]
   }
  },

Friday, July 9, 2010


   ],
   "replies": [
    {
     "href": "{url}/{userId}/@self/{commentId}/@comments?alt=json",
     "type": "application/json",
     "count": 2,
     "updated": "2010-05-09T02:53:13.730Z"
    }
   ]
  },
  "actor": {
   "id": "110242419133439594545",
   "name": "Chris Chabot",
   "profileUrl": "{url}/chabotc",
   "thumbnailUrl": "{url}/chabotc/thumb.jpg"
  },
  "verbs": [
   "post"
  ],
  "object": {
   "type": "note",
   "content": "content goes here",
   "links": {
    "alternate": [
     {
      "href": "http://www.google.com/buzz/a/google.com",
      "type": "text/html"
     }
    ]
   }
  },
  "source": {
   "title": "Buzz"
  },
  "visibility": {
   "entries": [

Friday, July 9, 2010


  },
  "verbs": [
   "post"
  ],
  "object": {
   "type": "note",
   "content": "content goes here",
   "links": {
    "alternate": [
     {
      "href": "http://www.google.com/buzz/a/google.com",
      "type": "text/html"
     }
    ]
   }
  },
  "source": {
   "title": "Buzz"
  },
  "visibility": {
   "entries": [
    {
     "id": "https://www.googleapis.com/buzz/v1/people/@me/@groups/@public?alt\u003djson",
     "title": "Public"
    }
   ]
  }
 }

Friday, July 9, 2010


  },
  "verbs": [
   "post"
  ],
  "object": {
   "type": "note",
   "content": "content goes here",
   "links": {
    "alternate": [
     {
      "href": "http://www.google.com/buzz/a/google.com",
      "type": "text/html"
     }
    ]
   }
  },
  "source": {
   "title": "Buzz"
  },

"visibility": {
  

   "entries": [
    {
     "id": "{url}/people/@me/@groups/@public?alt=json",
     "title": "Public"
    }
   ]
  }
 }

Friday, July 9, 2010


    "alternate": [
     {
      "href": "http://www.google.com/buzz/a/google.com",
      "type": "text/html"
     }
    ]
   }
  },
  "source": {
   "title": "Buzz"
  },
  "visibility": {
   "entries": [
    {
     "id": "{url}/people/@me/@groups/@public?alt=json",
     "title": "Public"
    }
   ]
},

"geocode": "37.783471 -122.39922",


"address": "701-737 Folsom St, San Francisco, CA 94103, USA",
"placeName": "300 3rd St, San Francisco, CA 94107"
}
 }

Friday, July 9, 2010


   ],
   "replies": [
    {
     "href": "{url}/{userId}/@self/{commentId}/@comments?alt=json",
     "type": "application/json",
     "count": 2,
     "updated": "2010-05-09T02:53:13.730Z"
    }
   ]
  },
  "actor": {
   "id": "110242419133439594545",
   "name": "Chris Chabot",
   "profileUrl": "{url}/chabotc",
   "thumbnailUrl": "{url}/chabotc/thumb.jpg"
  },
  "verbs": [
   "post"
  ],

  "object": {
   "type": "note",
   "content": "content goes here"
   }
  },
  "source": {
   "title": "Buzz"
  },
  "visibility": {
   "entries": [
    {
     "id": "https://www.googleapis.com/buzz/v1/people/@me/@groups/@public?alt\u003djson",
     "title": "Public"
    }
   ]
  }
 }

Friday, July 9, 2010


Friday, July 9, 2010
  "object": {
   "type": "note",
   "content": "content goes here",
"attachments": [
{
"type": "article",
"title": "Name of the link",
"links": {
"alternate": [
{
"href": "{url}/to/article.html",
"type": "text/html"
}
]
}
}
]
  }

Friday, July 9, 2010


Friday, July 9, 2010
  "object": {
   "type": "note",
   "content": "content goes here",
"attachments": [
   
     {
      "type": "photo",
      "links": {
       "preview": [
        {
         "href": "{url}/image_thumb.jpg",
         "type": "image/jpeg"
        }
       ],
       "enclosure": [
        {
         "href": "{url}/image.jpg",
         "type": "image/jpeg",
         "height": 190,
         "width": 260
        }
       ]
     }
    }
   ]
  }

Friday, July 9, 2010


   "object": {
    "type": "note",
    "content": "content goes here",
"attachments": [
{
"type": "video",
"title": "video description goes here",
"links": {
"alternate": [
{
"href": "http://www.youtube.com/watch?v=abcdef",
"type": "text/html"
}
],
"preview": [
{
"href": "{url}/default.jpg",
"type": "image/jpeg"
},
{
"href": "{url}/proxy?thumbnail_default.jpg",
"type": "image/jpeg"
}
]
}
}
]
Friday, July 9, 2010
Verbs Objects
Favorite Article Photo
Follow Audio Photo Album
Friend Bookmark Place
Join Comment Playlist
Play File Product
Post Folder Review
Save Group Service
Share List Status
Tag Note Video
Update Person

Friday, July 9, 2010


Verbs Objects
Favorite Article Photo
Follow Audio Photo Album
Friend Bookmark Place
Join Comment Playlist
Play File Product
Post Folder Review
Save Group Service
Share List Status
Tag Note Video
Update Person

Friday, July 9, 2010


Auth url: https://www.google.com/buzz/api/auth/OAuthAuthorizeToken
scope: https://www.googleapis.com/auth/buzz
domain: www.example.org
iconUrl: http://www.example.org/icon.png

Friday, July 9, 2010


https://www.google.com/buzz/api/auth/OAuthAuthorizeToken
?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fbuzz
&domain=www.example.org
&oauth_token=

Friday, July 9, 2010


Friday, July 9, 2010
Friday, July 9, 2010
http://code.google.com/p/oacurl/

Friday, July 9, 2010


http://code.google.com/p/oacurl/

mac:~ user$ echo \


  '{
    "data": {
      "object": {
        "type": "note",
        "content": "Bzz! Bzz! via JSON"
      }
    }
   }'| oacurl -t JSON -X POST \
"https://www.googleapis.com/buzz/v1/activities/@me/@self?alt=json"

Friday, July 9, 2010


http://code.google.com/p/oacurl/

Friday, July 9, 2010


http://code.google.com/p/oacurl/

mac:~ user$ echo '' | oacurl -X PUT \


"https://www.googleapis.com/buzz/v1/activities/@me/@liked/{activityId}"

Friday, July 9, 2010


http://code.google.com/p/oacurl/

Friday, July 9, 2010


http://code.google.com/p/oacurl/

mac:~ user$ oacurl -X DELETE \


"https://www.googleapis.com/buzz/v1/activities/@me/@liked/{activityId}"

Friday, July 9, 2010


Examples
...for fun and profit

Friday, July 9, 2010


Ping.fm Marginize Socialwok

Tweetdeck Meebo bar Shareaholic

Klout Seesmic Buzzzy

Friday, July 9, 2010


Boxee

Friday, July 9, 2010


Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
TweetDeck

Friday, July 9, 2010


Seesmic

Friday, July 9, 2010


Buzz Bingo
buzz-bingo.appspot.com

Friday, July 9, 2010


Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
How It Works

Friday, July 9, 2010


Friday, July 9, 2010
Friday, July 9, 2010
Friday, July 9, 2010
Sign-In & Auth for Buzz

client = buzz.Client()
client.build_oauth_consumer(
  OAUTH_CONSUMER_KEY,
  OAUTH_CONSUMER_SECRET
)
client.oauth_scopes.append(
  buzz.FULL_ACCESS_SCOPE
)

Friday, July 9, 2010


Sign-In & Auth for Buzz

request_token = \
  client.fetch_oauth_request_token(
    'http://example.com/oauth/callback/'
  )
# Save request token to the data store
authorization_url = \
  client.build_oauth_authorization_url(
    request_token
  )

Friday, July 9, 2010


Sign-In & Auth for Buzz

# User visits the authorization_url

Friday, July 9, 2010


Friday, July 9, 2010
Sign-In & Auth for Buzz
verifier = request.get('oauth_verifier')
# Lookup request_token in data store
client.oauth_request_token = request_token
access_token = \
  client.fetch_oauth_access_token(verifier
)
# Save access token to the data store

Friday, July 9, 2010


Friday, July 9, 2010
Generate Board
# Create a new board
topic_choices = \
  copy(models.board.TOPIC_LIST)
topics = []
# Select 24 topics at random.
# Center square is free space.
while(topic_choices and len(topics) < 24):
  element = random.choice(topic_choices)
  topic_choices.remove(element)
  topics.append(element)

Friday, July 9, 2010


Generate Board

for x in xrange(5):
  for y in xrange(5):
    if x != 2 or y != 2:
      # We skip over the 'Free Space'
      square = models.board.Square(
        parent=self,
        key_name=('%d:%d' % (x, y)),
        topic=topics.pop()
      )
      square.put()
      board[x][y] = square

Friday, July 9, 2010


Friday, July 9, 2010
Friday, July 9, 2010
Board Marked

for topic in models.board.TOPIC_LIST:


  if comment_text.find(topic.lower()) != -1:
    topics_found.add(topic)
# Calculate the topics we can score on
intersection = [
  topic for topic in player.topics
  if topic in topics_found
]
if intersection and \
    not player.has_post_scored(post_id):
  scoring_topic = random.choice(intersection)
  player.score_post(
    post_id, post_uri, scoring_topic
  )

Friday, July 9, 2010


Board Marked
if post.attachments:
  for attachment in post.attachments:
    if attachment.type == 'article':
      self.award_badge('share')
      break
if post.geocode and \
    post.actor.id != self.key().name():
  self.award_badge('geo')
elif post.geocode:
  self.award_badge('mobile')

Friday, July 9, 2010


Board Marked

# Create the attachments for the post


badge_attachment = buzz.Attachment(
  type='photo', enclosure=badge.badge_icon
)
link_attachment = buzz.Attachment(
  type='article',
  title='Buzz Bingo',
  uri='http://buzz-bingo.appspot.com/'
)

Friday, July 9, 2010


Board Marked
# Assemble our announcement Buzz post
badge_post = buzz.Post(
  content=post_content,
  attachments=[
    badge_attachment,
    link_attachment
  ],
  geocode=VENUE_GEOCODE,
  place_id=VENUE_PLACE_ID
)
# Create the post
self.client.create_post(badge_post)

Friday, July 9, 2010


Friday, July 9, 2010
Bingo!

horizontal_counts = [0, 0, 1, 0, 0]
vertical_counts   = [0, 0, 1, 0, 0]
for x in xrange(5):
  for y in xrange(5):
    if self.board[x][y] and \
        self.board[x][y].post_id:
      horizontal_counts[y] += 1
      vertical_counts[x] += 1

Friday, July 9, 2010


Bingo!

if (5 in horizontal_counts) or \
    (5 in vertical_counts):
  self.award_badge('bingo')
  if not self.bingo_count:
    self.bingo_count = 0
  self.bingo_count += 1
  self.put()

Friday, July 9, 2010


Buzz Bingo is open source!
code.google.com/p/buzz-bingo
buzz-bingo.appspot.com

Friday, July 9, 2010


What’s next?

Friday, July 9, 2010


https://code.google.com/apis/buzz/docs/

Friday, July 9, 2010


https://groups.google.com/group/google-buzz-api

Friday, July 9, 2010


http://code.google.com/p/oacurl/
http://code.google.com/p/buzz-php-client/
http://code.google.com/p/buzz-python-client/
http://code.google.com/p/buzz-java-client/

Friday, July 9, 2010


Q&A

Friday, July 9, 2010


Q&A

Friday, July 9, 2010


Thank you!

Friday, July 9, 2010


Idea Starters

• Multi-site photo viewer: consume photos and render them in a lightbox


• Event search (like BuzzWatching: restrict by date, and add location as well):
deal with the types and generate different renderings. Tweak ranking by
weighting
• Best Of Day/Week/Month viewer
• Community Finder: cluster people in your extended social around a topic
• People Finder: find people in your geographical area who have similar
interests

Friday, July 9, 2010


Idea Starters

• Trending topics. Topics or posts that are accelerating in the last N minutes.
• Hot places: FInd places that have the most activity within a given geographic
area.
• Buzz List (like Reader bundles): Allow users to create and share collections of
other users. Allow them the ability to subscribe to lists of other users.
• Auto-follow: based on my remote account (e.g. Flickr)
• Spoiler detection: scan the user's consumption API and mute posts that talk
about certain TV shows.

Friday, July 9, 2010

You might also like