get the sending time of messages in group chat messenger - facebook-graph-api

I am new in using messenger api or facebook api. I have a group chat on messenger. My idea is to get all messages for today in the group and get the sending time of each message. Not only that, I also need to know who sent that message? I need that data to test something. Does this have any solution? Thank you.

Related

Best way to calculate 24 hours window of Facebook Messenger

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?

Django+Twilio: How can I display inside my django app the sms I sent/received using twilio? (Architecture question)

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.

Can I send message to a page using Facebook Graph API?

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.

Amazon lex - Can the bot initiate a message?

I am new to amazon lex. I wanted to have the bot initiate a conversation instead of the user triggering the start flow by asking a question, is there a way to do that?
At the moment, it has to be handled client-side, i.e, you won't have this behavior in the test interface.
In Facebook Messenger, for example, you can setup a Greeting Text.

How to track messages from Facebook API

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.