Created
July 5, 2011 17:01
-
-
Save ziyadbazed/1065276 to your computer and use it in GitHub Desktop.
Blaast Integrasi dengan Facebook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('facebook').init({ | |
appId: '235670756450721', | |
appSecret: '9dde61f0fb36c78b8e2ec6385f8145ad', | |
scope: ['read_stream', 'read_requests', 'publish_stream', 'user_photos', 'friends_photos'] | |
}); | |
app.message(function(client, action, data) { | |
// Post to wall | |
client.facebook.post('hey', function(err, result) { | |
log.info('Posted to Facebook with err: ' + JSON.stringify(err)); | |
log.info('Posted to Facebook with result: ' + JSON.stringify(result)); | |
}); | |
// Retrieve current user's profile | |
client.facebook.profile(function(err, data) { | |
if (err) { | |
log.warn('Failed to fetch profile from Facebook.'); | |
return; | |
} | |
log.info('Facebook profile: ' + JSON.stringify(data)); | |
}); | |
// Retrieve current user's friends list with client.facebook.friends() | |
client.facebook.friends(function(err, data) { | |
if (err) { | |
log.warn('Failed to fetch friends from Facebook.'); | |
return; | |
} | |
log.info('Facebook friends: ' + JSON.stringify(data)); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('common/util'); | |
_.extend(exports, { | |
':load': function() { | |
app.on('connected', function() { | |
app.on('message', function(action, data){ | |
}); | |
}); | |
}, | |
':keypress': function(key) { | |
if(key === 'fire'){ | |
app.msg('test', {}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment