jjwallace

Does anyone know how to do player re-engagement.

Recommended Posts

I am trying to send the players score to the challenged player after a round of my game Sea Frenzy on FB.

It seems the code they gave doesn't work.  I have implemented everything they have asked for.  See documentation link below.

 

// This will post a custom update. If the game is played in a messenger
// chat thread, this will post a message into the thread with the specified
// image and text message. And when people launch the game from this
// message, those game sessions will be able to access the specified blob
// of data through FBInstant.getEntryPointData().
FBInstant.updateAsync({
  action: 'CUSTOM',
  cta: 'Play',
  image: base64Picture,
  text: {
    default: 'Edgar just played BASH for 9 points!',
    localizations: {
      en_US: 'Edgar just played BASH for 9 points!',
      pt_BR: 'Edgar jogou BASH por 9 pontos!',
    }
  }
  template: 'WORD_PLAYED',
  data: { myReplayData: '...' },
  strategy: 'IMMEDIATE',
  notification: 'NO_PUSH',
}).then(function() {
  console.log('Message was sent successfully');
});

 

20274129_158585391373063_1501118020871782400_n.png?_nc_cat=0&oh=3f9ed71b18295c7f0ca631f9667585ee&oe=5C0179ED

Documentation Here: https://developers.facebook.com/docs/games/instant-games/rich-gameplay-features

Share this post


Link to post
Share on other sites

You gotta first setup the context. updateAsync will assuming there is a context (such as a messenger chat). You can use shareAsync if you want the user to send invites by making him explicitly choose where.

Share this post


Link to post
Share on other sites

If you have done all that right, a common hitch is not giving the correct base64 URI. It should be the actual image data and not an URL pointing to a resource on a web server. 

Share this post


Link to post
Share on other sites

Hey JJ, long time no see ;)

Here is a bit of code we use, and seems to work ok:



var base64Picture = thumbnailImage; //this thumbnailImage is a large base64picture created online
//update the message to player
FBInstant.updateAsync({
	action: 'CUSTOM',
	cta: 'Play',
  	image: base64Picture,
  	text: {
    		default: facebookStuff.name + ' played their move',
    		localizations: {
      		  en_US: facebookStuff.name + ' played their move',
      		  es_LA: '\u00A1' + facebookStuff.name + ' jug\u00F3 su jugada!'
    		}
  	},
  	template: 'play_turn',
  	data: { myReplayData: '...' },
  	strategy: 'IMMEDIATE',
  	notification: 'NO_PUSH'
	}).then(function() {
  		// closes the game after the update is posted.
		consoleWrite("FBINSTANT Quit");
		FBInstant.quit();
	});

Don't know if you already got it sorted or not.. but may help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.