Created
November 23, 2013 19:05
-
-
Save silviopaganini/7618608 to your computer and use it in GitHub Desktop.
Facebook notification
This file contains 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
@sendTreeNow : (id, tree_id, complete, fail) => | |
# TODO get message data | |
template = "@[#{Facebook.user.id}] gifted you a tree in the Amazon. Name it now." | |
url = (window or document).location.origin + "trees/#{tree_id}" | |
$.get "https://graph.facebook.com/oauth/access_token?client_id=#{window.config.fb_app}&client_secret=#{window.config.fb_secret}&grant_type=client_credentials", (data) => | |
str = "https://graph.facebook.com/" | |
str += "#{id}/" | |
str += "notifications/" | |
str += "?#{data}" | |
str += "&template=#{template}" | |
str += "&href=#{url}" | |
$.post str, (data) => | |
if(data.success) | |
complete?() | |
else | |
fail?() | |
null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment