Naypam
Naypam

Reputation: 430

No POST responses from real time callbacks

Basic idea of what I'm doing. I want to grab a users' likes and print them in a CLI application (Python script that listens to GET/POST messages using the Twisted framework).

I have done the OAuth via an inline canvas with this HTML:
<a target='_top' href="https://www.facebook.com/dialog/oauth/?client_id=1111111111111&redirect_uri=https://apps.facebook.com/xxxxxxx/&scope=user_likes">Grant permissions</a>

Right all seems well?

Okay now I've gone to the Real Time Subscriptions section within the Facebook App section and added

See image* :https://i.sstatic.net/l2I3t.png And when I run the test, my python code successfully returns the result, see*: https://i.sstatic.net/9D2EK.png

So now I'm stuck though. Because what I expect to happen now is that when I like something that the callback will show up in my callback script. I'm simply printing anything given to render_POST and render_GET and the GET responses come out fine, for example

GET {'hub.verify_token': ['test'], 'hub.challenge': ['73678294'], 'hub.mode': ['subscribe']}
GET {'hub.verify_token': ['test'], 'hub.challenge': ['2038003566'], 'hub.mode': ['subscribe']}

But when I go off and like something, either as myself or as a test user (with the OAuth completed) there's no POST value. Nothing at all!

I figure there's something that I'm missing here. I'm expecting to see something like

{
  "data": [
    {
      "category": "Author", 
      "name": "Iain M. Banks", 
      "id": "111960934488822", 
      "created_time": "2013-04-22T13:21:42+0000"
    }, 
    {
      "category": "Movie", 
      "name": "The Life Of Brian", 
      "id": "110881634936650", 
      "created_time": "2012-12-17T07:48:24+0000"
    }
  ], 
  "paging": {
    "next": "https://graph.facebook.com/111111111/likes?limit=2&offset=2&__after_id=110881698346650"
  }
}

In my POST so that I can then proceed with the rest of my code. I hope somebody can clear this up for me! Thank you in advance!

*You need at least 10 reputation to post images

Upvotes: 0

Views: 233

Answers (1)

phwd
phwd

Reputation: 19995

The field likes corresponds to user/likes

All the pages this user has liked.

The User object supports the following connections

This object supports Real-Time Updates for the following connections: feed, friends, activities, interests, music, books, movies, television, likes, checkins.

https://developers.facebook.com/docs/reference/api/user/

So liking something may not get you what you want. You to ensure that the object liked is a page. Only then will Facebook POST to the callback.

In addition ensure that you are seeing the POST variables, which will occur in request.args and not request

http://twistedmatrix.com/documents/10.1.0/web/howto/web-in-60/handling-posts.html

Upvotes: 1

Related Questions