I´m trying to track messages sent to my Facebook friends.
For example: I sent a message to James Bond, how do I know if he read it or not?
The Facebook Graph API does not support this yet - http://developers.facebook.com/docs/reference/api/message/. I suspect this is because there is no guaranteed way to see if a message has been read or not based on how the user accesses their messages.
It would also require permission tokens to be passed in a three-legged (recipient to application, recipient to sender) verification.
Related
I notice Facebook Messenger Policy stated that the Page won't be able to send the user a message after 24 hours session/window ended.
I am trying to iterate over a list of Facebook User PSIDs, and send some update to them. For those users that are outside of 24 hours window, I would not want to send any message to them.
I have researched over the Facebook Messenger Graph API and found few of the API are suitable for use to calculate.
To get the user conversation ID
https://graph.facebook.com/v16.0/<PAGE_ID>/conversations?platform=messenger&user_id=<USER_ID>
To get the user message list containing Message ID
https://graph.facebook.com/v16.0/<CONVERSATION_ID>?fields=messages
To get the user specific message
https://graph.facebook.com/v16.0/<MESSAGE_ID>?fields=from,to,message
By using this method, I am able to know when is the last message sent by the user. But there are downside to this approach because just for a single user, I have to call multiple APIs and it might reach the Facebook Messenger Rate Limit.
Does anyone here have better solution in order to check this problem?
I have a high level architecture question:
I have a django app where users can send out sms to their contacts (telephone numbers, not users of my app). I am trying to implement a system where if someone replies to a specific text, such reply is forwarded to the user that started the thread.
I implemented an inbound webhooks to receive sms but I am now facing a problem: how do I know which text is a reply replying to? I can't seem to find any type of id in the sms inbound request and I am now starting to fear that this is just impossible.
Any idea? Should I try to use "Conversations"? Would that solve my problem and if so, how should I go about it?
Any suggestion?
Twilio developer evangelist here.
You cannot get the message that a user is replying to, because that doesn't exist in SMS. SMS messages are simply chronological. To test for yourself, open your SMS app and try to reply to the second to last message from someone.
You have a few options to try to tie a reply to a specific message:
Only ever send one message to be replied to at a time. Once you receive a reply to one message (or there's a timeout of some sort), send the next one.
Have the user enter a message identifier in their message. You can then parse the identifier out and associate the reply. This is not very user friendly and they may forget or get the wrong identifier in the message
Use multiple numbers to send the messages. So, if you have an active message you are waiting for a reply to, use a different number to send out the next message. You can then associate the reply based on the number the user replies to.
The last option is my preference since it doesn't affect the messages you can send at any time and doesn't require extra work on behalf of the user. It does require extra work to build a number pool and do the work to associate messages with sending numbers.
I want to create a web application using PHP which will allow to connect Facebook accounts with my application and once they authenticated my application can fetch inbox messages of that user and can auto reply to the messages received against authenticated Facebook accounts.
Also, allow user to send messages manually from my application to Facebook inbox.
Is this possible with Graph API or any other Facebook API which will allow me to do above mentioned things.
Some people was told that this feature is no longer available after Facebook Graph API v2.4.
and once they authenticated my application can fetch inbox messages of that user and can auto reply to the messages received against authenticated Facebook accounts.
Neither of those two things is possible.
You can not read the messages of user accounts any more, and you can not reply in their name either.
The only messaging that can be handled via API, is that between a user and a page.
Assuming you refer to Page conversations, not user conversation, see /conversations and /messages docs here:
https://developers.facebook.com/docs/graph-api/reference/page/conversations/
https://developers.facebook.com/docs/graph-api/reference/v5.0/conversation/messages
I saw that is possible to use Graph API to send message to a user, but I didn't find nothing about send message to a page. Is it possible?
It is not possible with the API, you can only reply to a User message as Page. Sending messages from Users to Pages is not really neccessary, Users can just use the Messenger for that. Prefilling would not be allowed anyway.
Is it possible to read direct messages using the facebook graph api? I can see a reference to a message object in the docs (http://developers.facebook.com/docs/reference/api/message/) but can’t see a call to get a collection of messages for a facebook page.
I eventually found this in the notifications call in the graph api ...
https://graph.facebook.com/id/notifications
I needed manage_notifications and read_mailbox extended permissions for this to work as well
using graph api and fql you can read messages
see https://developers.facebook.com/docs/reference/fql/ thread and message
be aware there is any difference for FB backend if a message has been sent from during online chat or while offline from chat