How to get the facebook fan page private messages through fql or graph - facebook

I have tried Page Messages
with the all the required permission i.e read_mailbox, read_page_mailboxes, etc (all the extended permission)
at length I get tried as
https://graph.facebook.com/456330641095467/conversations?access_token=BAAGgcfpJgfUBAHdKaE6KxMWo4rU6VU7psX7Ip4cLbG1yIvX80fkkTXm3ZApdYHmcISmqfnns1gPYZAHXWD2cXX7nMBcj4AK31uptfqJUjNAGXan1ftOK4Tw3sY1WsZD
but i get response as
{
"error": {
"message": "(#210) Subject must be a page.",
"type": "OAuthException",
"code": 210
}
}
I am unable to find out the issue. Please help.

Just use the access_token of page and you are done
yours output would be like this
{
"data": [
{
"id": "t_id.615971188431960",
"snippet": "ok fine reply on test 5:15",
"updated_time": "2013-04-16T12:15:12+0000",
"message_count": 8,
"tags": {
"data": [
{
"name": "inbox"
},
{
"name": "read"
},
{
"name": "seen"
},
{
"name": "sent"
},
{
"name": "source:web"
}
]
},
"participants": {
"data": [
{
"name": "Pragati Singh",
"email": "100000441901858\u0040facebook.com",
"id": "100000441901858"
},
{
"name": "Devdemo",
"email": "456330641095467\u0040facebook.com",
"id": "456330641095467"
}
]
},
"senders": {
"data": [
{
"name": "Devdemo",
"email": "456330641095467\u0040facebook.com",
"id": "456330641095467"
},
{
"name": "Pragati Singh",
"email": "100000441901858\u0040facebook.com",
"id": "100000441901858"
}
]
},

Related

Sending WhatsApp interactive message of list type fails when sent with image header

I am able to send interactive message with "button" type and 3 buttons with image header.
But sending interactive message with "list" type and same image header fails with error:
{
"meta": {
"api_status": "stable",
"version": "2.39.4"
},
"errors": [
{
"code": 1008,
"title": "Required parameter is missing",
"details": "Failed building interactive message. Invalid Header."
}
]
}
Is it possible that "list" interactive messages doesn't support "image" header without stating it in documentation?
Successful "button" interactive payload (image URL changed):
{
"to": "972000000000",
"type": "interactive",
"interactive": {
"body": {
"text": "Select a branch for the takeaway by writing the name/number"
},
"action": {
"buttons": [
{
"reply": {
"id": "MQ==",
"title": "1"
},
"type": "reply"
},
{
"reply": {
"id": "Mg==",
"title": "2"
},
"type": "reply"
}
]
},
"type": "button",
"header": {
"image": {
"link": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png"
},
"type": "image"
}
}
}
Successful "button" interactive message result:
Failed "list" interactive payload (image URL changed):
{
"to": "972000000000",
"type": "interactive",
"interactive": {
"body": {
"text": "Select a branch for the takeaway by writing the name/number"
},
"action": {
"button": "Options",
"sections": [
{
"rows": [
{
"id": "MQ==",
"title": "1"
},
{
"id": "Mg==",
"title": "2"
},
{
"id": "Mw==",
"title": "3"
},
{
"id": "NA==",
"title": "4"
},
{
"id": "NQ==",
"title": "5"
},
{
"id": "Ng==",
"title": "6"
},
{
"id": "Nw==",
"title": "7"
},
{
"id": "OA==",
"title": "8"
},
{
"id": "OQ==",
"title": "9"
},
{
"id": "MTA=",
"title": "10"
}
]
}
]
},
"type": "list",
"header": {
"image": {
"link": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png"
},
"type": "image"
}
}
}
Well, it does state it in the docs. I'm just blind:
Kinda weird though "image" header not supported for "list".

"from" field of comments on my Facebook Page are partially missing

I'm using Facebook Graph API to list all comments of posts of my Facebook page by using this call
/v3.1/me?fields=posts{comments{from,message,created_time,comments{from,message,created_time}}}
I am admin of the page and I use Page Access token for API calls.
This is what I get (Blacked out some details for privacy reasons)
{
"posts": {
"data": [
{
"comments": {
"data": [
{
"from": {
"name": "██P1██",
"id": "███6166"
},
"message": "Ich poste als ██P1██",
"created_time": "2018-08-02T08:58:47+0000",
"id": "2021000871244096_2067310823279767"
},
{
"from": {
"name": "██U1██",
"id": "███8640"
},
"message": "Ich poste als ██U1██",
"created_time": "2018-08-02T08:59:33+0000",
"id": "2021000871244096_2067311606613022"
},
{
"from": {
"name": "██P1██",
"id": "███6166"
},
"message": "Host an Schülling für mi?",
"created_time": "2018-08-02T09:00:23+0000",
"id": "2021000871244096_2067312356612947"
},
{
"from": {
"name": "██U2██",
"id": "███4255"
},
"message": "Ich bin’s der echte ██U2██.",
"created_time": "2018-08-02T09:02:16+0000",
"id": "2021000871244096_2067313976612785"
},
{
"from": {
"name": "██U3██",
"id": "███2062"
},
"message": "It's a me! ██U3██",
"created_time": "2018-08-02T09:03:43+0000",
"id": "2021000871244096_2067315156612667"
},
{
"message": "such a lonely boat 😢",
"created_time": "2018-08-02T09:15:12+0000",
"id": "2021000871244096_2067325063278343"
},
{
"message": "Der Gerät schneidet das Fleisch schweißfrei.",
"created_time": "2018-08-02T09:18:23+0000",
"comments": {
"data": [
{
"from": {
"name": "██P1██",
"id": "███6166"
},
"message": "Der Gerät ist vor die Chef in Geschäft!",
"created_time": "2018-08-02T09:23:02+0000",
"id": "2021000871244096_2067334489944067"
}
],
"paging": {
"cursors": {
"before": "QVFIUlpUWEduOVRaRGFITEFGajgxaXNadkhMVDVjbUwxMGRuelhRVzdNUHprak81U3dIVTFoQmQydkR1U0I2T09nMVAxcVVaN2Y3S1oyeUMyVVVTTVpMRm5B",
"after": "QVFIUlpUWEduOVRaRGFITEFGajgxaXNadkhMVDVjbUwxMGRuelhRVzdNUHprak81U3dIVTFoQmQydkR1U0I2T09nMVAxcVVaN2Y3S1oyeUMyVVVTTVpMRm5B"
}
}
},
"id": "2021000871244096_2067330469944469"
},
{
"message": "",
"created_time": "2018-08-02T09:19:34+0000",
"id": "2021000871244096_2067331519944364"
},
{
"message": "",
"created_time": "2018-08-09T09:01:43+0000",
"id": "2021000871244096_2079260155418167"
},
{
"message": "Heyho. Ich bins",
"created_time": "2018-08-09T09:10:48+0000",
"id": "2021000871244096_2079269595417223"
},
{
"message": "Heyho. Ich bin nochmal",
"created_time": "2018-08-09T09:11:49+0000",
"id": "2021000871244096_2079270622083787"
}
],
"paging": {
"cursors": {
"before": "WTI5dGJXVnVkRjlqZAFhKemIzSTZANakEyTWpVMU56STNNemMxTlRFeU1qb3hOVE15T1RVMk5UTXgZD",
"after": "WTI5dGJXVnVkRjlqZAFhKemIzSTZANakEzT1RJM01EWXlNakE0TXpjNE56b3hOVE16T0RBMU9UQTUZD"
}
}
},
"id": "195180353826166_2021000871244096"
},
{
"id": "195180353826166_227658903911644"
},
{
"id": "195180353826166_147002885360315"
}
],
"paging": {
"cursors": {
"before": "Q2c4U1pXNTBYM0YxWlhKNVgzTjBiM0o1WDJsa0R5TXhPVFV4T0RBek5UTTRNall4TmpZANk5ESXpNalV5TXpjMU5qZA3hPVFUwTWpnek5ROE1ZAWEJwWDNOMGIzSjVYMmxrRHlBeE9UVXhPREF6TlRNNE1qWXhOalpmTWpBeU1UQXdNRGczTVRJME5EQTVOZAzhFZAEdsdFpRWmJQT2p6QVE9PQZDZD",
"after": "Q2c4U1pXNTBYM0YxWlhKNVgzTjBiM0o1WDJsa0R5UXhPVFV4T0RBek5UTTRNall4TmpZANkxUVTBNamN3T0RrMU16QXlNVE15TWpJNU1UWVBER0ZA3YVY5emRHOXllVjlwWkE4ZAk1UazFNVGd3TXpVek9ESTJNVFkyWHpFME56QXdNamc0TlRNMk1ETXhOUThFZAEdsdFpRWk5XbFQxQVE9PQZDZD"
}
}
},
"id": "195180353826166"
}
As you can see, for some comments, the "from" field is missing and I don't know why (Example: comment with id 2021000871244096_2067325063278343 ("such a lonely boat 😢")).
P1 is the page itself
U1, U2 are users with admin rights
U3 is a normal user who liked the page
The author of 2021000871244096_2067325063278343 hasn't liked the page but the author of 2021000871244096_2079269595417223 has liked it afterwards (comment 2021000871244096_2079270622083787).
Is there any way to get the names of all users who comment on my page?
Reached out to FB-Dev-Group and FB-Platform Support. They don't include everything due to user settings and privacy reasons
https://developers.facebook.com/support/bugs/1618790588170504/
Plus, your app needs to be approved and live (mine is still in development mode)
https://www.facebook.com/groups/fbdevelopers/permalink/1897897803587058

Facebook graph API search query is not returning work field

When I search using facebook graph API ( using this link ),
graph.facebook.com/search?q=chinmay patel&type=user&fields=name,id,username,work,
it never returns the work back. Here is the result I get,
{
"data": [
{
"name": "Chinmay Patel",
"id": "100001500767227",
"username": "chinmayrp"
},
{
"name": "Chinmay Patel",
"id": "100000896291228",
"username": "chinmay99"
},
{
"name": "Chinmay Patel",
"id": "100003158872381",
"username": "chinmay.patel.9081"
}, .....
{
"name": "Chinmay Patel",
"id": "1007030149",
"username": "CPoverLord"
},
{
"name": "Chinmay Patel",
"id": "1150758330",
"username": "chinmay.patel.71"
},
{
"name": "Chinmay Patel",
"id": "100004835978500",
"username": "chinmay.patel.90834"
}
],
"paging": {
"next": "https://graph.facebook.com/search?fields=name,id,username,work&q=chinmay patel&type=user&limit=25&offset=25&__after_id=100004835978500"
}
}
Am I missing anything? Let me know, if you have any more questions.
work is not a public profile field. The user must either have your app installed and you issue user_work_history permission or the user is a friend of a user that installed the application and friends_work_history is issued.
https://developers.facebook.com/docs/reference/api/user/

/me/feed in facebook graph api has first comment of wallpost as separate status entry

when getting my feed with /me/feed it seems that the first comment on posts of other users on my wall is represented another time in the feed as an independent status entry (also has a different id) itself.
It looks like the following JSON output. The first entry of the list is apparently generated from the first comment of the second entry of the list.
I could not reproduce the problem, another post on my wall I commented on turned out normal (= no duplicate entry for first comment)
Is this a bug in Facebook itself or can someone explain this behavior?
[
{
"id": "someID_4300357461829",
"from": {
"name": "user1",
"id": "someID"
},
"story": "\"na oida\" on user2's post on your wall.",
"story_tags": {
"13": [
{
"id": "someID2",
"name": "user2",
"offset": 13,
"length": 15,
"type": "user"
}
]
},
"type": "status",
"created_time": "2012-11-03T01:41:15+0000",
"updated_time": "2012-11-03T01:41:15+0000",
"comments": {
"count": 0
}
},
{
"id": "someID_4300356661809",
"from": {
"name": "user2",
"id": "someID2"
},
"to": {
"data": [
{
"name": "user1",
"id": "someID"
}
]
},
"message": "hi!",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/someID/posts/4300356661809"
},
{
"name": "Like",
"link": "https://www.facebook.com/someID/posts/4300356661809"
}
],
"type": "status",
"created_time": "2012-11-03T01:40:54+0000",
"updated_time": "2012-11-03T01:45:21+0000",
"comments": {
"data": [
{
"id": "someID_4300356661809_4479943",
"from": {
"name": "user1",
"id": "someID"
},
"message": "na oida",
"created_time": "2012-11-03T01:41:15+0000"
},
{
"id": "someID_4300356661809_4479949",
"from": {
"name": "user1",
"id": "someID"
},
"message": "interesting",
"created_time": "2012-11-03T01:42:31+0000"
},
{
"id": "someID_4300356661809_4479956",
"from": {
"name": "user1",
"id": "someID"
},
"message": "another one",
"created_time": "2012-11-03T01:44:40+0000"
},
{
"id": "someID_4300356661809_4479959",
"from": {
"name": "user2",
"id": "someID3"
},
"message": "spam",
"created_time": "2012-11-03T01:45:21+0000"
}
],
"count": 4
}
}
]
I had this same issue. I've submitted a bug to facebook. Vote it up - https://developers.facebook.com/bugs/483624361705934
Just in case you haven't realised, those "wrong" posts doesn't have any action in it, so you can filter the right posts just checking if actions exist.

PHOTO import from facebook wall

I am working on this site and I want to import photos from facebook group.
https://www.facebook.com/EveryoneLovesaGoldenRetriever/photos
If you visit this link above you will be able to see three albums under heading "Everyone loves a Golden Retriever's Albums" and many photos under heading "Photos of Everyone loves a Golden Retriever" i am able to fetch photos under the albums but not able to sort out how can i fetch other photos that doesnt belong to any albums and comes under heading "Photos of Everyone loves a Golden Retriever"
Thanks you very much in advance
SP
https://graph.facebook.com/115641638572281/tagged
{
"data": [
{
"id": "115641638572281_446639348697240",
"from": {
"name": "Sudhir Puranik",
"id": "100000535372598"
},
"to": {
"data": [
{
"name": "Everyone loves a Golden Retriever",
"category": "Small business",
"id": "115641638572281"
}
]
},
"picture": "http://a2.sphotos.ak.fbcdn.net/hphotos-ak-ash3/s320x320/541201_446639348697240_100000535372598_1627958_1814759730_n.jpg",
"link": "http://www.facebook.com/photo.php?fbid=446639348697240&set=o.115641638572281&type=1",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v2/yz/r/StEh3RhPvjk.gif",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/115641638572281/posts/446639348697240"
},
{
"name": "Like",
"link": "http://www.facebook.com/115641638572281/posts/446639348697240"
}
],
"type": "photo",
"object_id": "446639348697240",
"application": {
"name": "Photos",
"id": "2305272732"
},
"created_time": "2012-05-15T07:43:58+0000",
"updated_time": "2012-05-15T07:43:58+0000",
"comments": {
"count": 0
}
},
{
"id": "115641638572281_446033935424448",
"from": {
"name": "Sudhir Puranik",
"id": "100000535372598"
},
"to": {
"data": [
{
"name": "Everyone loves a Golden Retriever",
"category": "Small business",
"id": "115641638572281"
}
]
},
"picture": "http://a5.sphotos.ak.fbcdn.net/hphotos-ak-ash3/s320x320/547601_446033935424448_100000535372598_1626229_2008301193_n.jpg",
"link": "http://www.facebook.com/photo.php?fbid=446033935424448&set=o.115641638572281&type=1",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v2/yz/r/StEh3RhPvjk.gif",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/115641638572281/posts/446033935424448"
},
{
"name": "Like",
"link": "http://www.facebook.com/115641638572281/posts/446033935424448"
}
],
"type": "photo",
"object_id": "446033935424448",
"application": {
"name": "Photos",
"id": "2305272732"
},
"created_time": "2012-05-14T12:59:13+0000",
"updated_time": "2012-05-15T14:19:48+0000",
"likes": {
"data": [
{
"name": "Barbara Fried",
"id": "1336683610"
}
],
"count": 1
},
"comments": {
"data": [
{
"id": "115641638572281_446033935424448_1363348",
"from": {
"name": "Barbara Fried",
"id": "1336683610"
},
"message": "They look like total love dogs!",
"created_time": "2012-05-15T14:19:48+0000"
}
],
"count": 1
}
}
],
"paging": {
"previous": "https://graph.facebook.com/115641638572281/tagged?format=json&limit=2&since=1337067838&__previous=1",
"next": "https://graph.facebook.com/115641638572281/tagged?format=json&limit=2&until=1337000352"
}
}