o365con14 - a developer jam with yammer
DESCRIPTION
European Office 365 Connect 2014 PresentationTRANSCRIPT
A developer jam with Yammer
Getting started with Yammer integration
March 2014
Agenda
Integration ScenariosGetting StartedApp registration and authenticationWorking with EmbedWorking with RESTWhat is Open Graph?ResourcesQuestions
About me
Focus on SharePoint Architecture and
Development
SharePoint Server MVP since 2013
SharePoint MCT, MCTIP, MCPD
CEO of NUBO GmbH – Munich
patrick.nubo-corp.com
patrick.lamber
Integration Scenarios
2. Office 365 feed integrationMore integration will follow in the next couple of months (not handled here)
1. System independent. Access by code SharePoint, ASP.NET, PHP, …. (handled in this session)
Getting started – In a nutshell
Register app AuthenticateAccess/Post data
to Yammer
Onlinehttps://www.yammer.com/client_applications
Client-side flow Embed
Server-side flow REST API
Realtime
Where are we now?
Register appRegister app AuthenticateAccess/Post
data to Yammer
Register your app
Register app
1) Registration under https://www.yammer.com/client_applications
2) Remember the Client ID
Register app AuthenticateAccess/Post
data to Yammer
Prepare your app
Register app
Register app AuthenticateAccess/Post
data to Yammer
3) Add JavaScript reference to your page
<script type="text/javascript" src="https://assets.yammer.com/platform/yam.js"></script>
4) Associate the Client ID on your page
<script type="text/ecmascript">yam.config({ appId: "YOUR CLIENT ID" });
</script>
Where are we now?
Register appRegister app AuthenticateAccess/Post
data to Yammer
Authentication flow (1/2)
Authentication through OAuth2
Server-side flow (“Authorization Code Grant”): Appropriate
when calling Yammer API through server side code
Client-side flow (“Implicit Grant”): Appropriate when calling
Yammer API through client-side code (web browser)
Register app AuthenticateAccess/Post
data to Yammer
User Authentication
App authorization App authentication
Authentication flow (2/2)
Register app
Register app AuthenticateAccess/Post
data to Yammer
Demo
Setup the environment and authenticate with client-side flow
Register app AuthenticateAccess/Post
data to Yammer
Where are we now?
Register appRegister app AuthenticateAccess/Post
data to Yammer
Working with Embed
Register app
Feeds(My Feed, Group Feed, Topic Feed, User Feed, OG
Object Feed)
Action Buttons
CommentingEvents
(Error, Login, Logout, Loading Competed)
Embed
Register app AuthenticateAccess/Post
data to Yammer
Feeds
Register app
Register app AuthenticateAccess/Post
data to Yammer
<script type="text/javascript">yam.connect.embedFeed({container: '#myFeed',network: 'lamber.eu',config: {
header: true,footer: false,promptText: "Comment on the site feed"
}});
yam.connect.embedFeed({container: "#groupFeed",network: "lamber.eu",feedType: "group",feedId: "3313365",config: {header: false,footer: false,promptText: "Comment on the group feed"
}});
</script>
Action buttons and Comments
Register app
Register app AuthenticateAccess/Post
data to Yammer
<script type="text/javascript">yam.connect.actionButton({container: "#myLike",network: "lamber.eu",action: "like"
});
yam.connect.actionButton({container: "#followMe",network: "lamber.eu",action: "follow"
})</script>
<script type="text/javascript">yam.connect.embedFeed({container: "#commenting",feedType: "open-graph",config: {header: false,footer: false
}});
</script>
Embed
Yammer
Demo
Working with Embed
Register app AuthenticateAccess/Post
data to Yammer
Working with REST
User needs to be authenticated to a network
Use “jam.request” function in the JavaScript SDK
Not all CRUD operations are available (e.g., no way to create
groups)
Register app AuthenticateAccess/Post
data to Yammer
Users
Messages
Attachments
SuggestionsNetworks
GroupsLikes
SubscriptionsTopics
Relationships
Notifications
Autocomplete
Search
Working with REST
Register app AuthenticateAccess/Post
data to Yammer
Autocomplete: 10 requests in 10 seconds.
Messages: 10 requests in 30 seconds.
Notifications: 10 requests in 30 seconds.
All Other Resources: 10 requests in 10 seconds.
Notes
Endpoints returning a status code of 429 (Too Many Requests) when exceeding
limits
Rate limits are per user per app
Limits are independent from each other
Examples of REST calls
Register app
Register app AuthenticateAccess/Post
data to Yammer
Delete
Write messageRead message
Demo
Working with REST
Register app AuthenticateAccess/Post
data to Yammer
What is Open Graph?
Register app
Register app AuthenticateAccess/Post
data to Yammer
Open Graph (OG) is used to define an activity which is posted to Yammer.
Allow users to see the activities of members and increase app usage
You can use “out-of-the” box activities or create your own
The activity takes the format:
<Actor> <Action> <Object> on <App Name>: <Message>
Open Graph Parameters
Register app
Register app AuthenticateAccess/Post
data to Yammer
Actions
• Create
• Update
• Delete
• Follow
• like
Object types
• Page
• Place
• Person
• Department
• Team
• Project
• Folder
• Etc.
Objects
• url
• Type (defaults to page)
• Title
• Image
• Description
Example for posting an activity
Register app
Register app AuthenticateAccess/Post
data to Yammer
var messageObject = {"activity": {
"actor": { "email": "[email protected]" },"action": "follow","object": {
"url": "http://en.wikipedia.org/wiki/Flower_power","title": "The history of Flower Power"
},"message": "This is a great site to start with"
}}
yam.request({url: "/api/v1/activity.json",method: "POST",data: messageObject,success: function (user) {
},error: function (user) {
$("#results").html('An error has occurred');}
});
Demo
Create out-of-the-box and custom objects with Open Graph
Register app AuthenticateAccess/Post
data to Yammer
Tips
Use Yammer SDK to simplify authenticationSubscribe to the Yammer Developer Network on YammerFor testing create your own network with test usersAn enterprise subscription is not necessary when starting with the development. For “complex” impersonation scenarios consider enterprise licensesUse a combination of REST and Embed to build you application
Key takeaways
Yammer provides feed and REST APIs to access data
Authentication can be solved by using either client side code oder server side code
Once authentication is solved, accessing Yammer data is pretty simple
Not all interfaces are available to access or post data
Resources
Open Graph Protocol (bit.ly/1gNT7ad)
Developer reference Yammer (http://bit.ly/1p9YDIL)
Yammer Blog (http://bit.ly/Nt1e4l)
Yammer Developers Network (http://bit.ly/1l2EyGU)
Yammer releases (http://bit.ly/1nCRc1o)
Yammer Office 365 support (http://bit.ly/1donbbQ)
Example of Server Side Flow in .NET (http://bit.ly/POn6ZZ)
My Blog (http://bit.ly/Ovv2hI)
All bundled links (http://bitly.com/bundles/o_6pdhih13v3/2)
FAQ
Questions?