When a Facebook user sends the Send dialog within an application, can the application track the recipients? - facebook

When users open a Send dialog (e.g. http://www.facebook.com/dialog/send?app_id=123050457758183&name=People%20Argue%20Just%20to%20Win&link=http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html&redirect_uri=http://www.example.com/response) they can add or remove people from the To: line.
Is there a way for the application to track who was in the To: line if and when the user actually pushes Send?

No.
At least not currently...
If you look at the official documentation: https://developers.facebook.com/docs/reference/dialogs/send/ then you can see that this type of dialog does not expect a callback function as a parameter, and since there's no callback function then you have no way of knowing who and/or how many recipients were, and even if the dialog is closed/canceled/sent.
What you can do, though seems very complicated and well, a headache, is to use the outbox connection of the User object in the graph api (http://developers.facebook.com/docs/reference/api/user/).
I've never used that before, but I guess that you can (if you ask for the read_mailbox permission) check the user messages before and after the dialog, and see what changed.

Related

Handle No Match input with custom logic in Confirmation Intent using Actions SDK

When I use the Confirmation Helper Intent on an Actions SDK project, it works as it's supposed to. But I want to handle the case when the user's input doesn't mean either yes or no (a No Match situation). Currently Assistant automatically re-prompts the user in this situation.
Actions SDK provides the user's actual input when a confirmation is granted or denied. But is there any way to know what the user said in a No Match situation?
For example, let's say, in a Confirmation prompt, the user says: "I just need some eggs. Just give me some eggs". This would cause Assistant to show the same prompt to the user again. It happens automatically and I have no way of accessing what the user actually said. If I want to do something when the user says "I just need some eggs" I can't do it because I can't access what the user is saying. Moreover, I haven't seen any Intent getting fired in this situation.
So, how can I handle No Match situations with custom logic instead of giving the default re-prompt to the user?
The easiest way is to not use the confirmation helper and just create Intents that handle "yes" or "no" equivalents yourself.

How to send message to specific facebook user from website?

My goal is to make a website, in which user could customize a photo and then provide his friends indicators like name or id. My next task is to fetch that info from database and send messages on specific date to provided users. Ex birthday wishes, greetings, and so on.
I studied facebook send api for a few days now and couldn't find solution for myself. If I want to send message, I need to have Page-scoped id of user, which is acquired when the person text you first, which is not desired, because person wouldn't know what it is.
Also I was looking into Customer matching API, also seems to require the same PSID. The next thing I checked was Send Dialog API, which seems to send messages instantly, but not on the specific date. Also I checked unofficial facebook-chat-api, which asks for user ID, whereas I can find my id, I couldn't find ids of my friends.
So I just want to know is it even possible, if yes, I'd really appreciate your help.
User to User communication is not possible (and not allowed) in an automatic way, there is no API for it except for the Send Dialog. The Messenger platform is for page to user communication only.
Do not use inofficial tools, they are not allowed and might get you banned.

Facebook Messenger Bot - How to disable bot and allow human to chat

so this is something I've been trying to think through for about 16 hours. I am coding with PHP / CuRl / etc - the bot works and everything is fine. My current issue is figuring out how to disable the bot and allow a human to begin chatting with the customer/sender.
Has anyone successfully, created a route for this ? I mean it's pretty hard from what I see, you'd have to disable etc etc. A lot of effort for my clients.
Thanks for any input.
Facebook has rolled out a "Handover Protocol" which is supposed to facilitate a combined human/bot Messenger implementation.
https://developers.facebook.com/docs/messenger-platform/handover-protocol
It is a little unclear what actually occurs in step 5:
Pass thread control: At some point in the conversation, a user may choose to do something like interact with a live agent. To handle this, pass thread control from the Primary Receiver to the Secondary Receiver. The Secondary Receiver will receive a messaging_handovers webhook event to notify it that is now controls the conversation.
This doesn't actually disable the bot (as the OP requested), and isn't in the control of the Page owner but rather of the user. It seems FB envisions the user typing something like 'I would like to chat with a human' triggering the bot to pass control...but it would be nice to let the page owner simply put the app in standby and handle the messages herself.
Once you recognize someone wants to speak to a human, set a flag that disables all actions of your bot to on.
Then, have your bot message you, or whoever will respond, that a user ID needs responding to. Have your bot continue to send all messages received from them back to you until you enable the bot again.
Create some sort of way for your bot to interact with you that allows you to send a message to a specific user, and a way to once again enable the bot interaction with the user.
Probably something like "sendMessage104012301230'Hi, sorry you couldn't find [etc]', and enableUser104012301230
There may be a better way, but those are some thoughts on how I'd do it
If you enable messages echo, whenever a human respond using the page, a echo post is sent, and inside entry->messaging->message there's no app_id.
You can use that information to disable bot replies for a certain period, or disable indefinitely until you enabled is with some admin command (that's how I'm doing)
I thought a solution could be to label the message as "unsolved". Another solution could be to have the bot mark the conversation as unread. Does anyone know if it is possibile to add a label to a conversation or mark as unread through API?

How can my app facilitate a message to multiple friends?

I have a facebook app that needs to allow a user to send a message to multiple friends (potentially all their friends) at once. This isn't any kind of spam, and I don't need the app to send the message incognito (behind the scenes), I just need to open a dialog with specific friends pre-populated (that the user has selected within my app in a prior step) and then send them a custom message. Is this possible? I see the api for sending a message to a single friend, and I see the API for inviting users to my app (but that's limited to some very small number of invitations per day)... what I need is a dialog that lets me send messages to as many of the user's friends as they want, but for me to control *which friends are selected... I don't want to give them control to add/remove from the friends list.
Is this possible?
No, the Send Dialog allows prefilling only a single friend, but would otherwise be the best option here if you need a custom message displayed to the recipient. You could get the user to send to several friends in a loop by prefilling this - or fire the dialog without prefilling and let the user chose who to send to - your app won't receive a callback with the recipient IDs but you could put a referrer param in the URL sent?
Failing that, the Requests dialog / 'invites' are the only thing you can prefill with multiple recipients without the expectation that your app will be shut down for spam shortly thereafter - there's no limit per day on the number of requests sent, but you don't get to set the message shown to the recipient.
In case this is helpful to anyone else, I just found this... it's a relatively new API (still in beta) that allows for (just about) exactly what I was asking for. I've tested it and it appears to work...
https://developers.facebook.com/blog/post/2012/08/31/reach-users-1-1-with-the-notifications-api/

Facebook APP alerts - The same thing as app requests?

I've used 'Are You Interested', a Facebook APP and when something on that app happens (such as a user sends me a message in that app) then I will see (to the left under APPS) a numeric value representing the number of new events that have happened on 'Are You Interested' since I last looked.
I want to do the same thing with my App, as it's also a niche dating site. I'd like to notify users when someone sends them a message or views their profile. I was told that I should search for app requests. However the code samples that I see seem to be slightly different than what I want to accomplish.
The information I am finding seems as though it is intended for me to allow my users to request things from their friends. That's completely different than what I want to do. There's no need for them to request anything from friends.
When I tried sending one to my test account, just to see what happens..it incremented the numeric value to the left under APPS by 1, which is a good thing, but the text was so generic, it was something like, "So and so is requesting something in [sitename]", but I don't want it to say that and I didn't see anywhere to change this text....furthermore, it added a 'Notification' to the very top of Facebook with the same generic request message. Again, that's not what I'm looking for. When I receive these APP Alerts for other apps, they don't add a 'Notification' up top of Facebook, and I don't want to either. I do believe that the code snippets I found under 'Requests' is something different than what I'm looking to achieve.
Just to summarize: I have a dating app, and people can send messages to eachother. I want an APP Alert (as I'm referring to it) to be seen to the left under Apps and also to the right in the bookmarks area, but I want the message to not be so generic and I don't want users to be selecting friends to request something. I want this action to come from my server and sent to the user that will be receiving the alert. I also do not want a facebook 'Notification' up top each time they receive a message. I hope I'm being clear in what I'm trying to accomplish. Thanks in advance for any guidance. -Chris