Post reply to Facebook conversation
Asked Answered
B

2

6

//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

Bully answered 16/10, 2013 at 9:38 Comment(2)
Comments are not a “conversation” in the FB sense – a conversation would be private messages between users, comments on posts are something completely different.Than
@CBroe The example is based on private messages between two users. Making a reply in facebook to a message will show up under comments. So I'm not sure I understand what your are saying?Bully
E
4

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

Entremets answered 23/10, 2013 at 21:17 Comment(1)
Great answer. Figured this out a couple of days ago and have started to build a Facebook Chat API based chat in C#. This will let users chat, and send messages when other user is not available for chat.Bully
S
-1

At first you must make video with your Test application with status on developing, and send to Facebook inspection (manage_pages, publish_pages); after approval everything will work.: enter image description here

Spurtle answered 24/4, 2020 at 16:41 Comment(1)
You do realize this i 7 years old? It has nothing to do with video och pages permissions either.Bully

© 2022 - 2024 — McMap. All rights reserved.