Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post reply to Facebook conversation

//Update: You can read th answer below. Solution is to build a chat using the facebook chat api(and you should use it as a chat, not a messaging system but it will leve messages.)

So I have the following conversation between me(HiQ) and Magnus on Facebook. As I understand there is no way to initiate a conversation from the graph api but I should be able to respond to messages according to https://developers.facebook.com/docs/reference/api/using-comments/

I have two problems. (my attempted solutions follows) 1. I cannot get the individual comment. Figure 2 (I can get comments collection Figure3) 2. I cannot reply to comments. Figure 2.

Also note I have all permissions set to allow and if I didnt graph api explorer should ask for it prior to request.

Figure 1. The message/conversation A json response for my conversation

Figure 2. I cannot retreive an individual comment(clicking on the one posted by logged in user .) Json error message

Figure 3. Response for just comments working fine. Json response and request comments collection

Attempted solutions: The documentation descripbes posting repluy to comments like this: https://developers.facebook.com/docs/reference/api/publishing/ https://developers.facebook.com/docs/reference/api/using-comments/

Creating Comments and Replies

An individual comment on an object which has a /comments connection can be created with an API call:

POST /{object-id}/comments? message='This is my message' message is the only parameter in this API call. It should be a string containing the comment text.

So I tried the following (with and without question mark after /comments). Figure 4. Attempt to post comment to comments: Error respnse and request in json

And directly towards the comment id(with and without question mark): json error code and request

Any suggestions welcome cause I'm seriously stuck! The implementation is done with Facebook C# SKD

like image 548
Magnus Karlsson Avatar asked Oct 16 '13 09:10

Magnus Karlsson


People also ask

Why can't I post a reply on Facebook?

So, if you're unable to post a comment, it may be due to a lack of permission for that specific Facebook page. Although you will still be able to see the post and other comments, you will not be able to participate since you are not a part of that customized group that is given that particular reign.

How do I share a Facebook post with replies?

1. Locate the post which you want to share and press the Share button in the bottom-right corner of the post. 2. In the pop-up menu that appears, select Share now if you want to instantly share the post or Share to News Feed if you want more control, including the ability to add descriptive text to the post you shared.


1 Answers

I don't think it's actually possible to send a reply to a private message via the graph api. I can see why this might seem confusing, especially as it has a 'comments' connection. From what I can gather from the docs https://developers.facebook.com/docs/reference/login/extended-permissions/ the "publish_actions" permission "Enables your app to post content, comments and likes to a user's stream" note that it only says post to a users STREAM.

I believe Facebook deprecated this ability due to the fact that apps could potentially spam users. All they would need is 1 legitimate message and they could constantly reply with comments. Also the message pages https://developers.facebook.com/docs/reference/api/message/ specifically only lists "reading" as an option.

You can also see the response in this post

how send message facebook friend through graph api using Accessstoken

What's interesting though, is that a Page account can reply to private messages, provided a user has initiated it first. And the page can only send 2 replies without a reply from the user. My guess is this allows for 1 "auto-responder" and then an actual reply from someone addressing a user https://developers.facebook.com/docs/reference/api/page/#messages This is probably to allow businesses to reply to customers.

My guess is that any app can't just send private messages as the potential for spam would be huge once you have a users access_token. There's obviously the send dialog that addresses this, but I appreciate in your case you want to reply to a message rather than create a new one.

The "send" button says it should be used in cases where the conversation is private, e.g where you might send an email.

https://developers.facebook.com/docs/reference/dialogs/send/

In an app situation, what this means realistically is that you would request the "read_mailbox" permission, you could then notify a user of your app that they have an unread message from a particular user. You could then create a send dialog, and prefill the "to" field with the uid of the friend who originally sent the message. This would then appear as part of the "comments" connection in the api explorer (I have tested this)

The only caveat is that a user could of course add additional names to the send dialog and in doing so start a new convo.

hope this helps

like image 153
TommyBs Avatar answered Oct 12 '22 02:10

TommyBs