Latest Updates: social networks RSS

  • Post to Facebook with Javascript SDK

    Ellen 13:55 on December 21, 2010 | 0 Permalink
    Tags: , , , social networks

    Posting a message to someones wall can contain the following parameters:

    var my_message = ‘This is just a test!’;
    var url = ‘http://www.sundh.com/’;
    var title = ‘This is the name of my post’;
    var desc = ‘Optional description of my link’;
    var picUrl = ‘http://www.sundh.com/blog/images/led.jpg’;

    To post the following to my wall this javascript code is executed:

    FB.api(‘/me/feed’, ‘post’, {message:my_message,link:url,name:title,picture:picUrl,description:desc },
    function(response) {
    if (!response || response.error) {
    alert(‘Error occured’);
    } else {
    alert(‘Post ID: ‘ + response.id);
    }
    });

    If I decided to not define the parameter “description” the post will grab the text appearing on the URL.
    facebook_post

    Youtube clip

    Posting a YouTube clip to someone’s wall requires a little bit different code in order to be able to play the YouTube clip within Facebook. Note that the URL to the YouTube clip is different from the URL shown in the browser when you watch the clip. Instead of “http://www.youtube.com/watch?v=VIDEO_ID”, it is set to “http://www.youtube.com/v/VIDEO_ID”. The thumbnail of the YouTube clips is easly retreived by accesing the URL “http://img.youtube.com/vi/VIDEO_ID/0.jpg”.

    var my_message = ‘My message here’;
    var url = ‘http://www.youtube.com/v/VIDEO_ID’;
    var title = ‘Title of YouTube clip’;
    var desc = ‘Description of YouTube clip’;
    var picUrl = ‘http://img.youtube.com/vi/VIDEO_ID/0.jpg’;

    The trick that makes the YouTube clip embeddable on Facebook is to add the parameter “source” in you API call to Facebook. The source is the same as the URL to the video clip.

    FB.api(‘/me/feed’, ‘post’, {message:my_message,link:url,name:title,picture:picUrl,source:url,description:desc }, function(response) {
          if (!response || response.error) {
            alert(‘Error occured’);
          } else {
            alert(‘Post ID: ‘ + response.id);
          }
        });

    The result looks like this:
    facebook_youtube

  • Facebook Connect: Only for grown ups

    Ellen 13:03 on February 6, 2010 | 0 Permalink | Reply
    Tags: , social networks

    In some Facebook Connect apps you might want to target an older audience. Any Facebook user is required to fill in their date of birth so the birthday field of the profile can be a way to check that your user has the appriopriate age for your application. This can be done by checking the birthday date of the user (birthday_date) using the function

    users_getInfo($uid, ‘birthday_date’).

    birhtdate

    Important to remember though is that if the Facebook user has chosen not to show the birth year, this will not be available for the Facebook Connect application. To determine that the Facebook user has the appropriate age her settings on Facebook must look as follows:

  • Add Facebook Connect to your blog comments

    Ellen 11:09 on December 15, 2009 | 0 Permalink | Reply
    Tags: comments, , , social networks

    This neat video explains how you can add Facebook Connect to your blog and let users add comments by logging into Facebook Connect! No server-side scripting needed!

  • Prefill Facebook private messages

    Ellen 15:02 on October 24, 2009 | 0 Permalink | Reply
    Tags: , social networks

    I just found this neat little feature on Facebook which allows you to send prefilled messages to a person on Facebook.

    Fill in:

    id (must be the number id)
    subject (string)
    message (string)

    The whole link looks like this:

    http://www.facebook.com/inbox/?compose&id=652519918&message=I%20am%20writing%20to%20you..&subject=Just%20checked%20your%20blog!

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
esc
cancel