notifications - nov/fb_graph GitHub Wiki

Notifications

GET

me = FbGraph::User.me(ACCESS_TOKEN)
me.notifications

UPDATE (mark as read)

notification = FbGraph::Notification.new(NOTIFICATION_ID)
notification.read!(:access_token => ACCESS_TOKEN)

POST

There are 2 ways to send notifications to a user.
I feel FbGraph::Application#notify! more natural, but it’s actually just calling FbGraph::User#notification! internally.

user = FbGraph::User.new('matake')
app = FbGraph::Application.new(APP_ID, :secret => APP_SECRET)

app.notify!(
  user,
  :href => 'http://matake.jp',
  :template => 'Your friend @[12345] achieved new badge!'
)
user.notification!(
  :access_token => APP_ACCESS_TOKEN,
  :href => 'http://matake.jp',
  :template => 'Your friend @[12345] achieved new badge!'
)
⚠️ **GitHub.com Fallback** ⚠️