jjwallace Posted August 7, 2018 Share Posted August 7, 2018 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'); }); Documentation Here: https://developers.facebook.com/docs/games/instant-games/rich-gameplay-features Quote Link to comment Share on other sites More sharing options...
rich Posted August 7, 2018 Share Posted August 7, 2018 Stick a catch on the end of the Promise and log the error, what does it output? Quote Link to comment Share on other sites More sharing options...
pingu Posted August 8, 2018 Share Posted August 8, 2018 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. Quote Link to comment Share on other sites More sharing options...
pingu Posted August 8, 2018 Share Posted August 8, 2018 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. Quote Link to comment Share on other sites More sharing options...
Noel Posted August 13, 2018 Share Posted August 13, 2018 @pingu, I was going to ask you about what you put as base64Picture, but it looks like you are setting it properly now. Quote Link to comment Share on other sites More sharing options...
jjwallace Posted August 30, 2018 Author Share Posted August 30, 2018 Do you guys have an example of what you do for your games? Quote Link to comment Share on other sites More sharing options...
o0Corps0o Posted September 23, 2018 Share Posted September 23, 2018 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.