Skip to content

Instantly share code, notes, and snippets.

View nmccarthy's full-sized avatar

Neil McCarthy nmccarthy

View GitHub Profile
@nmccarthy
nmccarthy / gist:4727823
Last active December 12, 2015 06:18
An answer to a question posed by Jan van Casteren in the Yammer Developers Network (https://www.yammer.com/yammerdevelopersnetwork). The yam.request method of the Yammer Javascript API will query a user's home network by default. To query any other network, you have to overwrite the HTTP header to use the appropriately token for the user (i.e. t…
<script type="text/javascript" data-app-id="YOUR-APP-ID" src="https://assets.yammer.com/platform/yam.js"></script>
<script>
yam.getLoginStatus(function(response) {
if (response.authResponse)
{
//GET THE TOKENS FOR ALL MY NETWORKS
yam.request({
url: "https://www.yammer.com/api/v1/oauth/tokens.json",
method: "GET",
success: function(msg) {
@nmccarthy
nmccarthy / gist:4658110
Created January 28, 2013 19:03
Posting to the Yammer message feed and @mentioning a user.
curl -X POST -d 'body=Hello @nmccarthy' https://www.yammer.com/api/v1/messages.json?access_token=asdf1234
@nmccarthy
nmccarthy / omniauth_staging_monkey_patch.rb
Created July 26, 2012 18:38
omniauth.rb initializer file that's been monkey-patched to work with Yammer Staging
Rails.application.config.middleware.use OmniAuth::Builder do
# provider :yammer, 'xxx', 'xxx' #production
# monkey-patch for staging
provider :yammer, 'xxx', 'xxx' #staging
module OmniAuth
module Strategies
class Yammer < OmniAuth::Strategies::OAuth2
option :client_options, {