Pregunta

I'm working on a project where you choose some friends to interact with the system. When you have chosen the friends you then send them a message to the inbox. The system will not work, if the users invited are not the same as the users who are selected.

How can I prevent the user from editing the users which he are sending a message to, using the Send Dialog?

¿Fue útil?

Solución

Multi friends can be pre selected provided you get the friendlist somehow, using either their user-ids(numeric) or usernames(alphanumeric). But you don't pass array, you pass a comma separated list of user ids, like this:

    FB.ui({
        method: 'send',
        to: '123123123,234234234',
        name: 'People Argue Just to Win',
        link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html',
    });

See more at : Send Dialog

Otros consejos

It's not possible to predefine the users for the SEND dialog. It always opens a popup or Iframe, where the user can choose if he want's to add users.

The method mentioned above selects only the first user.

Here is an excerpt from the doc:

to: A user ID or username of a recipient. Once the dialog comes up, the sender can specify additional people, groups, and email addresses as recipients. Sending content to a Facebook group will post it to the group's wall.

Your are also not able to preselect multiple users, this seems to be some kind of anti-spam measure of Facebook. Probably thats what they state here:

Facebook messages are a channel for person-to-person communication, and not for apps to send messages, or encourage people to spam their friends. In general, games on Facebook.com should use requests when communicating in game status (its your turn), inviting people to use an application, or sending messages to multiple people. You should offer the Send Dialog in situations when someone might otherwise send an email.

For years later, this answer is probably too late, but I was also researching how to do that, and didn't find a way.

References:
https://developers.facebook.com/docs/sharing/reference/send-dialog Facebook 'send' dialog to multiple friends Facebook send dialog to multiple friends using a recipients arrays

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top