How to mark as read inbox conversation with facebook graph api - facebook

I get message conversations via Facebook graph API which look like:
https://graph.facebook.com/' + tid + '/messages?fields=message
and i want to mark as read the message but i can't found how to in documents.
please can someone point me to some examples.

Related

Facebook Graph API - Fetch public event

I am new to the Facebook GraphAPI, the idea is to use it from Java facebook-sdk.
But at the moment I am just trying to run a simple request to fetch a public event
https://graph.facebook.com/v11.0/{event_id}?access_token={access_token}
But I am getting this error:
{
"error": {
"message": "Unsupported get request. Object with ID 'XXXXX' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "Apc-nisB6j0fD2LB--0gTSa"
}
}
I wonder if I need more permissions from organiser of the event, but the event says
"Public ยท Anyone on or off Facebook"
So why would we need permissions? I just need to fetch some data from the event like name, description and cover url.. I could do it by simple parsing the source code of the page, but API will be much more efficient. Could it be because its just postman or browser?
Thanks.
You don't need Facebook Marketing Partner status to get info about events.
All you need is:
App with "in development" status,
User access token obtained from https://developers.facebook.com/tools/explorer/
Create a GET request, for example
https://graph.facebook.com/**EVENT-ID-HERE**?fields=cover,name,description,start_time,end_time,id,attending_count,created_time,declined_count,interested_count,maybe_count,event_times,place,updated_time,ticket_uri,type,discount_code_enabled,noreply_count&access_token=**ACCESS-TOKEN**
Its worth to note, that
You should be "Interested" or "Going" to an event which data you want to GET info;
Event ID's should be extracted manually.
For the idea I personally do in this way:
Copy paste all event links to google sheet (and pressing interest)
With =SPLIT[cell;"/"] sheet formula I extract event IDs
Then I run script, that gets all the info Event contains.
Sorry for my unprofessional way of explaining things, I am not a Developer and I found this question because I am looking for answer about how to extract event cover photo without a specific App status. :))
I hope that this helps or anyone can explain this better.

Messenger Bot for comments

I am trying to make bot using facebook messenger api. My bot is working perfectly for direct messages. Now i want to add a feature called comment bot. Like when someone comments on my page post. I would like my bot to reply to the person. I added a webhook url for feeds. When some one comments in a post i get a respone similar to the following:
{"changes":[{"field":"feed","value":{"item":"comment","sender_name":"6sense","comment_id":"127569201201434_137925500165804","sender_id":126557694635918,"post_id":"126557694635918_127569201201434","verb":"add","parent_id":"12655769463
5918_127569201201434","created_time":1507031347,"message":".."}}],"id":"126557694635918","time":1507031349}
Now from that webhook, i am trying to reply back to user using the sender_id. But i am getting a long error which is in short
{ error:
{ message: '(#100) No matching user found',
type: 'OAuthException',
code: 100,
error_subcode: 2018001,
fbtrace_id: 'EmEDxfdcnyF' } } }
I saw some sites implementing this feature. So i guess its possible. But i am not sure why its not working. I am using the same app for this.
Try private_replies API with comment_id to send private replies to user.
To use this API you need read_page_mailboxes permission.

How do i mention user in my Comment while replying from FACEBOOK GRAPH API?

I am using Facebook graph API, I want to know that how can I mention person in a comment while i am replying to the POST?
when i am trying to do it with the format #[ID:NAME] E.g (#[12345:Abc]) it gives me an error like
{
"error": {
"message": "(#1705) There was an error posting to this wall",
"type": "OAuthException",
"code": 1705
}
}
As per this post of stack overflow Tagging/Mentioning Pages or Users in Posts via Graph Api
I come to know that you cannot tag user via API.
You can't tag people on a feed using the Graph API, you have to use
Open Graph concepts- Mention Tagging/ Action Tagging (based on your
requirement)
Source : Tagging/Mentioning Pages or Users in Posts via Graph Api
You can use Open Graph API -
https://developers.facebook.com/blog/post/2012/08/21/bringing-mention-tagging-to-open-graph/

Facebook API For Pulling Reviews

Has anyone seen a full example of how to pull facebook reviews using the graph api.
According to the docs:
A page access token is required to retrieve this data.
I have code that asks a user to login already and gets an auth token which I can use to post a message to their facebook feed. Is there an additional step I need to do to be able to read their reviews/ratings?
Here is an example of the code to post to their feed/page.
response = Curl.post("https://graph.facebook.com/#{page_id}/feed", {
:message => message,
:access_token => auth_token
})
Thanks
If you're referring to Page Ratings (different from App Reviews!), then the endpoint is
GET /{page_id}/ratings
as described here: https://developers.facebook.com/docs/graph-api/reference/page/ratings You'll need a Page Access Token for this.
Where I get a little bit confused is that you mention that you want to
read their reviews/ratings
In that case it's something else, because afaik it's currently not possible to query the User's Page ratings via Graph API or FQL. It's was only possible to query App Reviews via FQL (see https://developers.facebook.com/docs/reference/fql/review/) (Update: FQL is no longer available since 2016)
You need to set permission in the app to access the {GET /{page_id}/ratings} API. The permission is common for
/page/comments,
/page/posts,
/page/ratings,
/page/tagged,
and the permission name is "pages_read_user_content"
https://developers.facebook.com/docs/permissions/reference/pages_read_user_content

How mark a Facebook notification as read via Facebook API?

I have managed to get a list of new Facebook Notifications but can't seem to find a way of marking them as read?
I am using FQL with the PHP SDK.
Please can someone point me to some documentation with examples.
To mark a notification as read, POST to
graph.facebook.com/NOTIFICATION_ID
with param "unread"=0.
If you've received the notification object via Grapth API, NOTIFICATION_ID equals the id of the notification object.
If you've received the notification object via FQL, you'll have to build NOTIFICATION_ID as follows:
"Notif_" + userId + "_" + notification_id.
For example if current userId is 123 and notification_id from FQL is 456, NOTIFICATION_ID should be:
notif_123_456
and the POST becomes:
graph.facebook.com/notif_123_456
with parameter unread=0
You'll need 'manage_notifications' permission.
To read notifications, you will need to get manage_notifications permission from the user. (Presuming you already have that is you can getList).
To mark a notification as read you need to use:
notifications.markRead
You can find information on this page.
http://developers.facebook.com/docs/reference/rest/notifications.markRead/
You cannot use straight FQL to mark a notification as read and you can only mark notifications that have been created (as I am led to believe) during the current user session.