Facebook request dialog with custom message notification - facebook

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.

Related

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.

Is it possible to determine the #Facebook.com email address of a user?

Is it possible to figure out reliably what the Facebook email of any Facebook user would be? I know earlier this was not possible because not all users had a username. But I believe that has changed since...
I'm trying to figure out a way to let a user send a direct message to their friend through my app. The Request feature is pretty messed up now as you cannot send a custom message, which means most friends are probably going to ignore the request.
The type of messages that I am trying to let my users send to their friends would not be considered spam by Facebook, as these are messages sent directly from the user to their friend, except it is done through the app. But it's pointless if the message just says "Joe wants you to try this app..." The usefulness of an app on the Facebook platform is becoming questionable now.
I think that facebook terms and conditions disallow this...
Facebook messaging (i.e., email sent to an #facebook.com address) is designed for communication between users, and not a channel for applications to communicate directly with users."
Despite your caveat at the end of your post I believe that facebook would consider this a message from your app to the user.
In terms of your question, then the user data returned includes 'username' which is the information you need to create the email address.
Is it possible to figure out reliably what the Facebook email of any Facebook user would be? I know earlier this was not possible because not all users had a username. But I believe that has changed since...
Yes, now every user should have a username set – if not by themselves, than FB will have chosen one for them.
Besides that, I think writing to userid#facebook also works.
But I agree with combinatorial’s answer – Facebook explicitly says that this should not be used for app-to-user communication. To judge if your case is OK is up to you – otherwise you might consider using the send dialog instead, that’s more of the “designated” way to have users communicate “through” your app.
If what you are looking for is to give them a new message notification, it is not going to work. Because, if you send an email to the facebook email, it will land in the Others folder in the message box, which is like a spam box.Try mailing your own #facebook id and see what happens.
And Facebook doesnt give any documentation of how to get users #facebook email, most probably because they dont want developers to use it.
Why dont you mail them directly? You can easily get their email by adding email to the scope, and you can catch the email easily too.
$data = file_get_contents("https://graph.facebook.com/me?access_token=xxxxxx");
$data = json_decode($data,true);
$email = $data['email'];
Is that a viable option in your case?

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/

Sending messages through application

In a Facebook application, is there anyway I can let a user send a message to another user (to his Inbox)? Even if there is no direct access, is there some kind of a link structure I can use such as:
"facebook.com/example?sendTO=user-id" that will prompt a facebook popup to send a message a user?
Joel
You can't send a message to another user via facebook's apis as no function exist for this. The only way to send personal and private messages are via emails (proxified or not), then the user must install your application and accept to share its email.
Just add "messages" in between the link:
If the persons id is https://www.facebook.com/some.one.007 then write
https://www.facebook.com/messages/some.one.007
Thats it.