How can my app facilitate a message to multiple friends? - facebook

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/

Related

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.

Start conversation without user interaction in Facebook Messenger

Is it possible to send a message to a user without the user interacting with the bot first?
I'm using the following guide to retrieve psids from users that have already connected their profile to an app that I own.
https://developers.facebook.com/docs/messenger-platform/connecting-accounts.
For users that have at least one interaction with a page that I also own, I'm able to get their id. For all other users the endpoint returns an empty array.
Im aware of customer matching but is that the only way to achieve this?
You can't send a message by bot before the user initializes the conversation.
Facebook Messanger Bot permits a standard messages, with a 24-hour interval
to reply to a message initiated by a user. In Some specific cases, Facebook permits to send a message after this time.
A message are triggerd when the user either sends a message to a company or clicks a call button for action in Messenger, or when the user requests a message from a company through a plugin, such as send to Messenger.
Check out the policies here : https://developers.facebook.com/docs/messenger-platform/policy-overview
You are correct, customer matching is your only option for this.
Just learned this today, if you have a user's phone number, you can message them unprompted. You also need the pages_messaging_phone_number permission, which you can only get by paying the $99 customer matching fee.
Check the docs on sending to phone numbers here. Customer matching docs here

Sending users messages - The right way

we would like to let the logged user in our web site invite his friends to participate in some scenario, IIRC the options we have are:
Keep in mind, we MUST know which users the message/notification sent to in order to interact back with the selection.
1) Raise a request dialog, with the multi friend selector, but unfortunately the 'message' field in the 'apprequest' dialog is only displayed in the app center and is not visible in the top bar notifications. which is very important for us.
2) Send a personal message, but this has no friend selector, so we raise the 'send' dialog but the selected recipients by user are not being recieved in the callback (only status is recieved back)
This question was asked here:
When a Facebook user sends the Send dialog within an application, can the application track the recipients?
We thought maybe to raise our own dialog for friend selection, and then popup the 'send dialog' with a pre-defined recipients but the user still can change the recipient in the send dialog (there's no way to freeze the selected recipients)
So what is the solution for this requirement?
Thanks.
We have decided to go with app notifications as it's the best option for the current restrictions.

Problems of inviting friends through Facebook email

I want my users to invite their friends by sending them Facebook private massage. I am thinking of using send button, but the problem is that each invitation url is different and unique, so if I use send button to do it, I might need to create many send buttons each of which carries an unique href. I think this should work? But ideally, I want users to just select their friends in a multi friend selector and everything's done by just clicking the sending button. Any ideas?
Thanks for any help!
You can generate a unique URL for the message that includes the IDs for all the users the user wants to send the message to. Then, when the recipient accesses the URL and authenticates themselves, you can cross reference the URL and their User ID to what you have in your database.
Without knowing what the message contains, its purpose and what you want to achieve, this is the best approach I can think of.
You won't be able to tell who the message is actually sent to, as Facebook doesn't return the User IDs in the callback, but if you have read_inbox permissions, you should be able to look the User IDs up that way.
i think an better way to approach this is set up an invite system, have an invitation code field in your register.php that you sign into, store that info in user account database and set an number of times it can be used

Facebook request dialog with custom message notification

I have a very simple use case. My app lets users send invitations to his friends, say for a birthday party. Friends then accept the invitation(and app).
I am using RequestDialog to send notifications to multiple users. Notification was sent successfully but the message is confusing to the user as it says
"User A Invited you to try APPNAME. Try Now".
Is there a way to customize this message? It should something like
"User A Invited you to his birthday party using APPNAME. Accept it now"
I believe I cannot use app generated requests as invitees hasn't authorized the app yet.
Any other ideas or workarounds to send notification, message with a link so users can click on it and accept the app and thus accept the birthday invitation?
You should use message parameter of Requests Dialog
message - The Request string the receiving user will see. It appears as a question posed by the sending user. The maximum length is 255 characters. The message value is not displayed in Notifications and can only be viewed on the Apps and Games Dashboard. Invites (requests where the recipient has not installed the app) do not display this value.
I memory serves, Facebook used to let you customize (many years ago), but, probably due to abuse, they no longer allow you to customize what the invitee sees. It's all standard. However, when the user comes to your app to authenticate, you can customize the Enhanced Auth dialog to your content.
I don't think there's a way to customize invite messages, and interestingly, to Usman Ashraf's point, as far as I can tell BranchOut can't do this anymore either (or at least I can't replicate it with their app). If anybody else can replicate it, let me know.
What you might want to do would be to allow
new_style_message: true,
Under your
FB.ui({
method: 'apprequests',
new_style_message: true,
message: "is bringing you to the UPicnic !",
display: "iframe"
},somefunction);
What this does is when the notification is sent to the user(s) , it will show up as the message instead. Not much customization but that's the least I can find.