Facebook achievements API tools

Why do Facebook make their achievements so difficult to manage?  iOS game centre has a streamlined GUI dashboard that allows achievements to be created, updated and maintained, and Google Play provide a nice GUI to do the same thing.

Facebook, on the other hand, force you to build each achievement as a separate HTML file with the appropriate meta tags, maintain a unique URL, upload the files to your own server, and then manually register these by writing a script and running that on the server.  You’ll be bogged down in code trying to determine the correct access_token to use and parsing response objects and nonsensical error messages!

Maybe in time some of this at least may be available via the Facebook app dashboard.  But for now, use these scripts 🙂

These Facebook achievement helper scripts allow you to easily register achievements, update achievements and delete achievements for your Facebook app.  You’ll still have to create an HTML file for each of your achievements and upload them to your server, but you won’t have to write a line of code to register, update or delete them.

Disclaimer: First read the readme.txt in the zip for details, including the NO WARRANTY disclaimer.

Download the Facebook achievements PHP helper scripts here.

Full details of how to use the scripts are contained in readme.txt in the zip file.  But just quickly:

  1. Create your achievement HTML files and put them on your server (see FB docs). Add an extra meta tag to specify the display order (see important notes below)
  2. Unzip these (and a copy of the PHP facebook SDK) scripts to that same folder
  3. Edit _config.php with your app ID and secret, and the path to the PHP Facebook SDK
  4. Call _register.php in your browser to register achievements with FB (skips ones already registered)
  5. Call _update.php in your browser to update achievements with FB (also registers new ones)
  6. Move achievement files to a ‘delete’ subfolder and call _delete.php to delete achievements from FB

Some important notes:

  • Add an additional meta tag to your achievements to specify the display order. This is the order that Facebook displays your achievements in a list to the user.  The number must be an integer and be unique.  lower numbers appear before higher numbers in the list.  the meta tag is: <meta property=”order” content=”42“/>
  • You can update achievements by registering them again, but Facebook states that ‘after a large number of updates, the achievement will be locked and no longer editable’. Just a warning.
  • Facebook do not recommend deleting achievements unless you are doing so during development/testing

Hope it helps!