Google Analytics

Social Data Hub - Getting Started

This document describes the requirements for integrating with the social data hub and provides an example of a valid Activity Stream and notification via PubSubHubbub.

  1. Introduction
  2. Activity Stream Requirements
  3. Delivering Activity Stream via PSHB
   

Introduction

This document is intended for developers who are interested in integrating their social data with Google’s social data hub. If you are unfamiliar with the social data hub eligibility requirements, Activity Streams, or the PubSubHubbub protocol, read the Overview guide.

This guide will describe how to:

  1. Prepare your Activity Stream to meet all requirements.
  2. Understand the PubSubHubub delivery requirements.

Activity Stream Requirements

The social data hub expects an Atom/RSS Activity Stream feed of global activities from your social network/platform.

The following information must be present within every Activity Stream update:

  • Actor
    • username or screen name
    • display name: full name of user, if available
    • author profile URL, if available
    • author profile photo URL, if available
  • Object
    • update text: text or (x)html with the actual content of the update
    • permalink: url that uniquely identifies the update
  • Verb: type of event (post, favorite, comment, etc)
  • Publication date: date when update was created
  • Provider: name of your network
  • Other meta-data such as geo location, or follower counts

Example Activity Stream feed:
http://profile.typepad.com/markpasc/activity/atom.xml

Other meta-data such as geo-location or follower counts can be provided based on the semantics of the network and activity.

Delivering Activity Stream via PSHB

If you are approved as a social data provider then you can begin pushing data to the social data hub.

Instead of creating individual subscriptions for each Activity Stream feed provided for each user of the social service, which would be resource intensive for both sides, an alternative "push-based" mechanism should be implemented.

Google’s public hub will provide a custom "firehose notification endpoint", including:

  • A virtual publish endpoint
    Example: http://pshbsubber.appspot.com/sub/custom_name
  • A shared secret. The shared secret is established between Google and your network for lightweight verification purposes.

With the virtual publish endpoint and shared secret, your ongoing responsibility is:

  • when a new activity is generated on your social network/platform, a “fat ping” (a notification ping which includes the Activity Stream formatted Atom blob) is sent to the publish endpoint.
    • POST http://pshbsubber.appspot.com/sub/custom_name
    • BODY: <atom formatted Activity Stream feed>
      • Note: a single ping can carry multiple activity entries
    • The POST request must also include an X-Hub-Signature header, the value of which is the SHA-1 message digest of the POST body signed with the agreed shared secret key (for lightweight verification).

"fat ping" Example:

POST http://pshbsubber.appspot.com/sub/custom_name
X-Hub-Signature: sha1=secret_checksum

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:activity="http://activitystrea.ms/spec/1.0/">
  <id>http://youtube.com/activity_stream</id>
  <title>YouTube Activity Stream</title>
  <published>2012-06-19T14:00:00Z</published>
  <updated>2012-06-19T14:00:00Z</updated>
  <author>
    <name>YouTube</name>
    <uri>http://youtube.com/</uri>
  </author>
  <entry>
    <id>http://youtube.com/watch?v=12345#comment-001</id>
    <link rel="alternate" type="text/html" href="http://youtube.com/watch?v=12345#comment-001"/>
    <title type="text">Edgar posted a comment</title>
    <published>2012-06-19T14:00:00Z</published>
    <content type="html"><![CDATA[Check out <a href='http://google.com/'>Google</a>"]]></content>
    <author>
      <id>http://youtube.com/edgar</id>
      <uri>http://youtube.com/edgar</uri>
      <name>Edgar</name>
      <activity:object-type>person</activity:object-type>
      <link rel="alternate" type="text/html" href="http://youtube.com/edgar"/>
      <link rel="preview" type="image/jpeg" href="http://youtube.com/avatars/3053/iamedgar_large.jpeg"/>
    </author>
    <activity:verb>comment</activity:verb>
    <activity:object>
      <id>http://youtube.com/watch?v=12345#comment-001</id>
      <title type="text">Edgar posted a comment</title>
      <published>2012-06-19T14:00:00Z</published>
      <activity:object-type>comment</activity:object-type>
      <link rel="alternate" type="text/html" href="http://youtube.com/watch?v=12345#comment-001"/>
      <content type="html"><![CDATA[Check out <a href='http://google.com/'>Google</a>"]]></content>
    </activity:object>
  </entry>
</feed>


Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.