">mixi Developer Center (mDC)

mixi Apps

mixi Apps (English) » Technical Specification » PC » Let’s Invite Friends

Let's Invite Friends

If a mixi App is very fun/useful to use, its users are willing to recommend it to their Friends. Then, the users who were recommended the mixi App may feel the same way, and the number of the users exponentially increases through the viral communication/recommendation among the users.


OpenSocial prescribes an invitation function that a user can inform an application to the other users. In the mixi App specification, the same “invite” function is also supported.

Inviting Friends

The opensocial.requestShareApp() is available in order to invite Friends on the mixi App. This function enables the user to recommend the mixi App to Friends who are not using that mixi App currently.

opensocial.requestShareApp("VIEWER_FRIENDS", null, function(response) {
  if (response.hadError()) {
    var errCode = response.getErrorCode();
    // do something...
  } else {
    // do something...

The arguments for the requestShareApp()can be specified as follows:

  • The first argument must be “VIEWER_FRIENDS.”.
  • The second argument must be null (anything that is passed is ignored).
  • The third argument specifies the callback function to be called after the invitation.

When the requestShareApp() is called, the following pop-up window is displayed to the user.


By selecting Friends and pressing “INVITE” button with any message to the Friends in this pop-up window, the user is able to send an invitationto the Friends. At this point, the Friends have not installed the mixi App yet.

After the pop-up window is closed, the callback function specified as the third argument is called. This callback function enables the developer to make some follow-up process after the invitation.

Restrictions on Use of the requestShareApp()

The requestShareApp() is available only when the mixi App is running on run_appli.pl. When the requestShareApp() is called on other pages, nothing is performed (an error message with FORBIDDEN is passed to the callback function).

Besides, the requestShareApp() requires the user (Viewer) running the mixi App must own the application as the Owner. In other words, the requestShareApp() is available only under the circumstance that the Viewer must install the application. If the user does not install the application, nothing is performed (an error message with FORBIDDEN is passed to the callback function).

Information of the Invited User

For some mixi Apps, information which Friends a user actually invited is available. The ID of Friends the user selected and invited can be retrieved from the callback argument specified in the requestShareApp().

opensocial.requestShareApp("VIEWER_FRIENDS", null, function(response) {
  var recipientIds = response.getData()["recipientIds"];
  // do something...

The “recipientIds” is retrieved by the result of the getData() created from the argument passed to the callback function. This “recipientIds” is stored in array of user IDs of the Friends the user has selected and invited.