">mixi Developer Center (mDC)

mixi Apps

mixi Apps (English) » Technical Specification (new method) » 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.

Preparing for Activity API

You need to previously prepare for using the Activity API.

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 invitation to 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.

Information of the Invited User

For some mixi Apps, information which Friends are 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) {
  if (response.hadError()){
    // エラー時の処理
    var code = response.getErrorCode();
    var msg = response.getErrorMessage();
  else {
    // 成功時の処理
    var data = response.getData();
    var recipientIds = data["recipientIds"];

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.

When the error occurring, you can get the error information with the haderror() and the getErrorCode() function. It is the error code possibly occurs as shown in the table below.

Error code Error message Status
401 Insufficient scope Not obtaining the user permission of mixi_apps2 score