Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 734877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:25:26+00:00 2026-05-14T07:25:26+00:00

We use Facebook Connect on our site in conjunction with the WWW::Facebook::API CPAN module

  • 0

We use Facebook Connect on our site in conjunction with the WWW::Facebook::API CPAN module to publish to our users newsfeed when requested by the user.

So far we’ve been able to successfully update the user’s status using the following code:

use WWW::Facebook::API;
my $facebook = WWW::Facebook::API->new(
    desktop => 0,
    api_key => $fb_api_key,
    secret => $fb_secret,
 session_key => $query->cookie($fb_api_key.'_session_key'),
 session_expires => $query->cookie($fb_api_key.'_expires'),
 session_uid => $query->cookie($fb_api_key.'_user')
);

my $response = $facebook->stream->publish(
 message => qq|Test status message|,
);

However, when we try to update the code above so we can publish newsfeed stories that include attachments and action links as specified in the Facebook API documentation for Stream.Publish, we have tried about 100 different ways without any success.

According to the CPAN documentation all we should have to do is update our code to something like the following and pass the attachments & action links appropriately which doesn’t seem to work:

my $response = $facebook->stream->publish(
 message => qq|Test status message|,
    attachment => $json,
    action_links => [@links],
);

For example, we are passing the above arguments as follows:

$json = qq|{ 'name': 'i\'m bursting with joy', 'href': ' http://bit.ly/187gO1', 'caption': '{*actor*} rated the lolcat 5 stars', 'description': 'a funny looking cat', 'properties': { 'category': { 'text': 'humor', 'href': 'http://bit.ly/KYbaN'}, 'ratings': '5 stars' }, 'media': [{ 'type': 'image', 'src': 'http://icanhascheezburger.files.wordpress.com/2009/03/funny-pictures-your-cat-is-bursting-with-joy1.jpg', 'href': 'http://bit.ly/187gO1'}] }|;
@links = ["{'text':'Link 1', 'href':'http://www.link1.com'}","{'text':'Link 2', 'href':'http://www.link2.com'}"];

The above, nor any of the other representations we tried seem to work. I’m hoping some other perl developer out there has this working and can explain how to create the attachment and action_links variables appropriately in Perl for posting to the Facebook news feed through WWW::Facebook::API.

Thanks in advance for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:25:26+00:00Added an answer on May 14, 2026 at 7:25 am

    I think the problem is that your JSON string might be invalid. I was able to get it to work by just using JSON::Any to serialize a Perl data structure instead of building the JSON string manually. (WWW::Facebook::API uses JSON::Any under the hood; it would be nice if it could take a Perl data structure instead of a JSON string. I will try to submit a patch this weekend.)

    use WWW::Facebook::API;
    use JSON::Any;
    
    my $j = JSON::Any->new;
    
    my $fb = WWW::Facebook::API->new( 
        desktop => 0, 
        api_key => $api_key, 
        secret  => $secret, 
        session_key => $session, 
        session_expires => $expires, 
        session_uid => $fb_uid 
    );
    
    my $res = $fb->stream->publish( 
        message => 'Test message', 
        attachment => $j->objToJson( 
            { name => 'Foo bar baz', 
              href => 'http://www.google.com/', 
              description => "this is a thing" 
           } ), 
        action_links =>  $j->objToJson( 
          [ { text => 'action link text', 
              href => 'http://www.foobar.com/' 
          } ] ) 
    );
    

    The result:

    http://www.friedo.com/fb_attach.jpg

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a site that uses Facebook Connect for user login/creation. I
I am looking for a way to connect to Facebook by allowing the user
We have a social site, and want to integrate facebook connect to save time
Is it possible to use Facebook connect with Jquery? I've found some old posts
When you use facebook connect on the iPhone do you have to use the
I am working on an iPhone app that use Facebook Connect. Its working fine
A website I am working on has to use the Facebook Connect Old JavaScript
I am writing an iframe based facebook app. Now I want to use the
I can't seem to get a facebook connect app that I am building to
I'm creating a new site and I want the users to be able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.