**Working** Publish to Facebook users wall from app :-) !!!

StusAppsStusApps Member, PRO Posts: 1,352
edited November -1 in Working with GS (Mac)
Hi all,

Just been working away at a little something that has now reached a workable state. It is a feature I will be putting into my next game 'Monkey Up'.

So basically with a lot of javascript fiddling I managed to get my server to interpret different URL links using the same script that then posts the relevant data to the users facebook page. So for example if the player beats level 1 then the URL link sent simply states this, level 2 the same, etc.... The script on the server then takes this and picks the correct status update, then if the player clicks the 'FB' button it redirects the iPad/iPhone browser to an authorisation page, autofills all the relevant links and pics for the status update and and then posts to their wall. (does that make any sense?!?).

It's all playing along pretty seamlessly now (except we have no way to return to the app apart from double tapping home and using the multi-tasking).

Here are some pics, I'll post a video when I get time tomorrow:

So .... click the facebook button:

image

Takes the user to this page:

image

Then this pops up:

image

And this is what it looks like on their page. Every text link and the image direct straight to the appstore purchase page for the app.

image

Stu
«1

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Very nifty!

    I am wondering if you would be able to offer this service in the market place? I wouldn't even begin to know how to do the serve-side scripting.
  • StusAppsStusApps Member, PRO Posts: 1,352
    I'll post the script and a howto once I've tidied it all up. Once I get it to that state it will just be a case of setting a few things in the Facebook dev area and swapping your pics and links into the script before uploading to your hosting space.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    StusApps said:
    I'll post the script and a howto once I've tidied it all up. Once I get it to that state it will just be a case of setting a few things in the Facebook dev area and swapping your pics and links into the script before uploading to your hosting space.

    Wow! That's very generous of you.
  • StusAppsStusApps Member, PRO Posts: 1,352
    Well it's been made from lots of helpful bits of JavaScript I've used from open source stuff, I'd feel bad charging for that. Also by posting it some others may be able to improve on it.
  • POMPOM Member Posts: 2,599
    @Stu
    its an amazing find mate! you caught my attention !
    looking forward for more info on this
    Roy.
  • DalleZDalleZ Member Posts: 85
    Indeed very generous of stu :)
  • StusAppsStusApps Member, PRO Posts: 1,352
    Interesting thing as well from doing this is that I've learnt for GS to implement facebook integration in the creator would take a day at most, then in the info.plist they could add the correct URL to return to the app.
  • guru-at-zidwareguru-at-zidware Member Posts: 369
    Please make a template...I we would all gladly PAY for this...fantastic...!!
  • 1UpGamestudio1UpGamestudio Member Posts: 213
    great!!!!!!!!!!!!!!
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    thats very cool. It's even better than just posting a status update from a link.
    guru-at-zidware said:
    Please make a template...I we would all gladly PAY for this...fantastic...!!

    I'm pretty sure this is going to be a web thing you have to run on your own web site to make this work.
  • jtadeojtadeo Member, PRO Posts: 92
    I'd love to see more of this :D

    Do you need the pro version for this to work?

    In the past, I've contacted GS about being able to pass a name/value pair from a game but at this time it is apparently impossible.

    Nice hack and very cool!
  • WyrdGuitaristWyrdGuitarist Member, PRO Posts: 91
    Muchly impressed, nice one Stu!
  • spliketspliket Member Posts: 93
    awesome work. maybe the GS team should contact you on tips for implementing this directly in GS.

    also, since you used open source code, i think it would technically be illegal to sell it...most open source code comes with a license forbidding you from putting it in a for-profit product. from my understanding. though, you could probably just change some things around in the code and then it wouldn't be the same code.
  • PhoticsPhotics Member Posts: 4,172
    Heh, I post basically the same thing a few weeks ago and the response was a bit different... like a moderator telling me I was posting too much. Ha, this community is funny.

    http://gamesalad.com/forums/topic.php?id=19324

    You don't need Javascript to accomplish this.
    You do need the pro version, as it uses hyperlinks.

    I think it's a good way to end the game, so that players can brag on Facebook that they beat the game. It doesn't matter if they're leaving the app then, as the game is over.
  • jtadeojtadeo Member, PRO Posts: 92
    Photics said:
    Heh, I post basically the same thing a few weeks ago and the response was a bit different... like a moderator telling me I was posting too much. Ha, this community is funny.
    ...
    You do need the pro version, as it uses hyperlinks.

    Good to know that pro is not required.

    @Photics, with your method, is it an in-game link?

    I'll check out your link. Thanks for the post.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    jtadeo said:
    Good to know that pro is not required.

    @Photics, with your method, is it an in-game link?

    I'll check out your link. Thanks for the post.

    pro is required
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Photics said:
    Heh, I post basically the same thing a few weeks ago and the response was a bit different... like a moderator telling me I was posting too much. Ha, this community is funny.

    http://gamesalad.com/forums/topic.php?id=19324

    You don't need Javascript to accomplish this.
    You do need the pro version, as it uses hyperlinks.

    I think it's a good way to end the game, so that players can brag on Facebook that they beat the game. It doesn't matter if they're leaving the app then, as the game is over.

    Photics this is different. The Facebook app is actually interacting with your app. not just posting a pre determined message within a link as a status. I think this has some potential to be much more efficient. And just to be fully accurate a similar method was posted weeks before yours.
  • jtadeojtadeo Member, PRO Posts: 92
    @JohnPapiomitis

    Thanks for that info.

    I had a quick look at the different methods and they all seem to be passing hard coded data vs. dynamic data. Is this correct?

    For example, how would a high score be passed?
  • jtadeojtadeo Member, PRO Posts: 92
    @StusApps we await your good reply :D
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I think this only works for achievements. For achievement you have a different url. The real work must be done server side. I imagine you check which url it is coming from and that tells the server what achievement the player completed. HOW this works is way beyond me!
  • RHRH Member Posts: 1,079
    That's amazing, nice one.
  • apps4everyoneapps4everyone Member Posts: 103
    Great work Stu (and Photics in your previous posting).

    It's fantastic that you guys share this kind of thing so that we can all benefit. Makes us more like a team than a group of individuals.

    I look forward to when I can contribute something more than "Hey, I've worked out how you can make your actor bigger"

    Simon
    www.octappus.com
  • PhoticsPhotics Member Posts: 4,172
    tenrdrmer said:
    The Facebook app is actually interacting with your app.

    How's it actually interacting with the app?

    As for posting achievements to Facebook, I think pre-generated text makes more sense.

    The OpenURL is not dynamic... so you can have lots of static HTML pages, or one dynamic page... with PHP, Javascript, or similar technique.

    That was the other main point in my earlier thread... if OpenURL was dynamic... and we had access to the system clock/date... we could make our own leaderboards, with some basic encryption to discourage cheating.
  • jtadeojtadeo Member, PRO Posts: 92
    Photics said:

    ...

    That was the other main point in my earlier thread... if OpenURL was dynamic... and we had access to the system clock/date... we could make our own leaderboards, with some basic encryption to discourage cheating.

    Yes, this is the part that's stumped me with OpenURL. At this time, there is no way to pass an in-game value dynamically to the target URL.

    If there was a way that GS could include a behavior that allows us to collect in-game values to pass as a payload to a defined url, then *that* would be powerful.

    What would be better is if we can custom create our own behaviors as plugins.
  • StusAppsStusApps Member, PRO Posts: 1,352
    Hi Guys,

    It was night time where I live, just woke up.

    As mentioned in the first post this script needs to receive a specific URL link to post a specific status update. Posting a highscore would not be possible using this method. It is working in connection with the facebook javascript sdk at the server to achieve the authorisation and the ability to write to the facebook stream (wall) through the graph API.

    I'll post a video of it working later so you can see if it is something you might want to implement.

    @photics

    A dyanmic openURL would not really help in this case and IMO you HAVE to use javascript to achieve this. If you can write a method to access the facebook.streampublish() function or talk to the graph API without javascript then I'd love to see it, it can't be done through just URL arguments. It is not using php/javascript to just dynamically accept the URL links, it is to interact with the whole facebook system. The user has to grant access for you to be able to post to their stream. Also if not logged in it needs to launch a login window that then still continues the task of authorising and then posting. Your method was through the sharer.php that facebook is planning on removing soon. sharer.php only takes a url and page title as arguments and is pretty limited in how you can control it. This method I posted also grants you access to post other information at a later date (like updates to your game) straight to their wall as well and stores data about which users have shared your game in your facebook developer area. But hey, as the 'professional web developer' that you are then I'm sure you know best and can post for us another solution.
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    I can only say 'Wow', you guys are really helping to improve game making experience. But i do believe this server - client communication is not something a normal GS user could implement easily.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    I'm game. I'm on a free web hosting now so prob can't use it like that, but if it means something like this I will gladly go paid web hosting.
  • design219design219 Member Posts: 2,273
    Brilliant sir.
  • butterbeanbutterbean Member Posts: 4,315
    Wow very cool!
Sign In or Register to comment.