Facebook post to another page?

Hi,

I tried searching and could not find an answer on this. I have written an app to post pictures on my Facebook page using the code below.

facebook.request( "me/photos", "POST", attachment )  

If I want to post on a friend’s Facebook page and the security is set for anyone to see his page rather than just friend, how would I do this? Just replace me with his name of the page?

Thanks,

Warren
[import]uid: 184193 topic_id: 34847 reply_id: 334847[/import]

replace “me” with the ID number for his account…

“102493484/photos” [import]uid: 199310 topic_id: 34847 reply_id: 138532[/import]

replace “me” with the ID number for his account…

“102493484/photos” [import]uid: 199310 topic_id: 34847 reply_id: 138532[/import]

Thanks for the reply. I just now got a chance to try it on another Facebook page. At first I did not know the ID of the site so I used the following site to confirm the ID which is it.

https://graph.facebook.com/526045664084660

The URL returns the following data:

{
“is_published”: true,
“location”: {
“street”: “320 Main Street”,
“city”: “Savannah”,
“state”: “GA”,
“country”: “United States”,
“zip”: “31419”,
“latitude”: 32.105092,
“longitude”: -81.144682
},
“phone”: “(912) 927-0020”,
“talking_about_count”: 0,
“were_here_count”: 0,
“category”: “Bar”,
“id”: “526045664084660”,
“name”: “Savannah Saloon”,
“link”: “http://www.facebook.com/pages/Savannah-Saloon/526045664084660
}

So I did what you said and replace me/photos with 526045664084660/photos and it did not upload. I don’t get an error either. It just does not upload. Is there anything special I need to do to make it happen? I created that business page and I assume anyone can upload to it because there are no settings to make it public or private. And I can view the page without logging into Facebook.

Thanks,

Warren
[import]uid: 184193 topic_id: 34847 reply_id: 141280[/import]

I still cannot get any photos posted to this other site. Does anyone have any input or suggestions on how to post to another Facebook page? I have searched on here and cannot find any answers.

Thanks!!

Actually I just tried it again and got an error:

Write error: ssl=0x632620: I/O error during system call, Broken pipe [import]uid: 184193 topic_id: 34847 reply_id: 141522[/import]

Actually with the braking changes posted by Facebook at the following URL, will we even be able to post pictures/comments to other pages other than “me”?

https://developers.facebook.com/roadmap/#march-2013

Removing ability to post to friends walls via Graph API
We will remove the ability to post to a user’s friends’ walls via the Graph API. Specifically, posts against [user_id]/feed where [user_id] is different from the session user, or stream.publish calls where the target_id user is different from the session user, will fail. If you want to allow people to post to their friends’ timelines, invoke the feed dialog. Stories that include friends via user mentions tagging or action tagging will show up on the friend’s timeline (assuming the friend approves the tag). For more info, see this blog post.

Does this mean we will need to use a dialog?
[import]uid: 184193 topic_id: 34847 reply_id: 141526[/import]

With my current project, I use dialog. I was unable to post message on friend’s wall/feed using /PROFILE_ID/feed. It gave me HTTP error 403. Once I switched to dialog, I no longer get HTTP error 403.

Anyhow, here’s a relevant thread:

http://developer.coronalabs.com/forum/2012/11/22/has-facebook-posting-stopped-working-last-week#comment-132107

BTW, which daily build are you using? Is it daily build 990 or earlier? If yes, I suppose it may mean that Facebook is really going to break a lot of people’s already released apps with FB feature…

Naomi

Edit: Ummm… about uploading photo, sorry, I haven’t investigated, especially since I have no need for it for my app at the moment. So if my post is irrelevant to what you are trying to do, I apologize. [import]uid: 67217 topic_id: 34847 reply_id: 141549[/import]

Thanks. I was using the following code which is me/photos instead.

facebook.request( "me/photos", "POST", attachment )  

Facebook says they will still support the dialog method to post to another Facebook page so you may be in luck. Can you show how you use a dialog to upload in Corona? I take a picture with the camera and then did the post so it was easy. In the dialog do you have to select the picture to post? Or can I pass the name of the picture to the dialog when I call it to save a step?

Thanks!!!

Warren
[import]uid: 184193 topic_id: 34847 reply_id: 141554[/import]

Hi Warren, this is how I do the dialog. I use a PNG file that resides on web server and have it post on friend’s wall. I don’t bring in the photo/image from the device:

local attachment = {  
 app\_id = APPID,  
 to = FriendFBID,  
 link = "http://www.myappwebsite.com",  
 picture = myAppURL .. "myappimage.png",  
 name = "Here's the title of my post!",  
 description = "Here's my message to you."  
 }  
facebook.showDialog( "feed", attachment )  

As to uploading photo, this blog post might help:

http://www.coronalabs.com/blog/2011/12/16/uploading-photos-to-facebook-in-corona/

Naomi
[import]uid: 67217 topic_id: 34847 reply_id: 141557[/import]

Your code is very similar except I’m not using the dialog. But I may be able to set the attachment like I am below with the image added in that I take with the camera and use the dialog like you have. I will give it a try.

One thing is I don’t have to call the login in the code. If I try to call the request without being logged in it will show the login dialog automatically. I will have to see if I need to do this with the dialog routine or not. Thanks again!

 local attachment = {  
 message = field1.text,  
 source = {   
 baseDir=system.TemporaryDirectory,   
 filename="CameraShot.jpg",   
 type="image",  
 },  
 }  
 facebook.request( "me/photos", "POST", attachment )  

[import]uid: 184193 topic_id: 34847 reply_id: 141560[/import]

It looks like you are using the properties named specifically for the Facebook feed dialog. Do you know if I can post a picture this way with a local filename which I have already saved on on the phone? I take a picture with the camera and know where it is saved and the filename. I’m not sure if I can set the source to be the file somehow.

Thanks,

Warren
[import]uid: 184193 topic_id: 34847 reply_id: 141568[/import]

Hi Warren, I’m not sure. Looking at the dialog properties on FB page, it doesn’t look like you’d be able to directly upload a photo from your device to a friend’s feed using feed dialog:

https://developers.facebook.com/docs/reference/dialogs/requests/

I could be wrong… but it almost feels like you may need to use some sort of intermediary (like uploading a saved photo to your web server, and use the URL for that uploaded photo to be added to the dialog? – rather convoluted. There may very well be a better way to do it, but I have not needed to do it, so I haven’t really looked into it myself.

Naomi

P.S. That said, if I were you, I’d experiment and see if the path to a file name on your device (rather than the URL to an image) would do the job. [import]uid: 67217 topic_id: 34847 reply_id: 141570[/import]

I tried different variations to post a local file and could not get it to work. I read where people got this to work coding it in other apps and even the Facebook app lets you upload a picture from your phone.

Has anyone does this using the Facebook.showDialog() method? If so, can you post an example?

Thanks!!
[import]uid: 184193 topic_id: 34847 reply_id: 141573[/import]

Thanks for the reply. I just now got a chance to try it on another Facebook page. At first I did not know the ID of the site so I used the following site to confirm the ID which is it.

https://graph.facebook.com/526045664084660

The URL returns the following data:

{
“is_published”: true,
“location”: {
“street”: “320 Main Street”,
“city”: “Savannah”,
“state”: “GA”,
“country”: “United States”,
“zip”: “31419”,
“latitude”: 32.105092,
“longitude”: -81.144682
},
“phone”: “(912) 927-0020”,
“talking_about_count”: 0,
“were_here_count”: 0,
“category”: “Bar”,
“id”: “526045664084660”,
“name”: “Savannah Saloon”,
“link”: “http://www.facebook.com/pages/Savannah-Saloon/526045664084660
}

So I did what you said and replace me/photos with 526045664084660/photos and it did not upload. I don’t get an error either. It just does not upload. Is there anything special I need to do to make it happen? I created that business page and I assume anyone can upload to it because there are no settings to make it public or private. And I can view the page without logging into Facebook.

Thanks,

Warren
[import]uid: 184193 topic_id: 34847 reply_id: 141280[/import]

I still cannot get any photos posted to this other site. Does anyone have any input or suggestions on how to post to another Facebook page? I have searched on here and cannot find any answers.

Thanks!!

Actually I just tried it again and got an error:

Write error: ssl=0x632620: I/O error during system call, Broken pipe [import]uid: 184193 topic_id: 34847 reply_id: 141522[/import]

Actually with the braking changes posted by Facebook at the following URL, will we even be able to post pictures/comments to other pages other than “me”?

https://developers.facebook.com/roadmap/#march-2013

Removing ability to post to friends walls via Graph API
We will remove the ability to post to a user’s friends’ walls via the Graph API. Specifically, posts against [user_id]/feed where [user_id] is different from the session user, or stream.publish calls where the target_id user is different from the session user, will fail. If you want to allow people to post to their friends’ timelines, invoke the feed dialog. Stories that include friends via user mentions tagging or action tagging will show up on the friend’s timeline (assuming the friend approves the tag). For more info, see this blog post.

Does this mean we will need to use a dialog?
[import]uid: 184193 topic_id: 34847 reply_id: 141526[/import]

With my current project, I use dialog. I was unable to post message on friend’s wall/feed using /PROFILE_ID/feed. It gave me HTTP error 403. Once I switched to dialog, I no longer get HTTP error 403.

Anyhow, here’s a relevant thread:

http://developer.coronalabs.com/forum/2012/11/22/has-facebook-posting-stopped-working-last-week#comment-132107

BTW, which daily build are you using? Is it daily build 990 or earlier? If yes, I suppose it may mean that Facebook is really going to break a lot of people’s already released apps with FB feature…

Naomi

Edit: Ummm… about uploading photo, sorry, I haven’t investigated, especially since I have no need for it for my app at the moment. So if my post is irrelevant to what you are trying to do, I apologize. [import]uid: 67217 topic_id: 34847 reply_id: 141549[/import]

Thanks. I was using the following code which is me/photos instead.

facebook.request( "me/photos", "POST", attachment )  

Facebook says they will still support the dialog method to post to another Facebook page so you may be in luck. Can you show how you use a dialog to upload in Corona? I take a picture with the camera and then did the post so it was easy. In the dialog do you have to select the picture to post? Or can I pass the name of the picture to the dialog when I call it to save a step?

Thanks!!!

Warren
[import]uid: 184193 topic_id: 34847 reply_id: 141554[/import]

Hi Warren, this is how I do the dialog. I use a PNG file that resides on web server and have it post on friend’s wall. I don’t bring in the photo/image from the device:

local attachment = {  
 app\_id = APPID,  
 to = FriendFBID,  
 link = "http://www.myappwebsite.com",  
 picture = myAppURL .. "myappimage.png",  
 name = "Here's the title of my post!",  
 description = "Here's my message to you."  
 }  
facebook.showDialog( "feed", attachment )  

As to uploading photo, this blog post might help:

http://www.coronalabs.com/blog/2011/12/16/uploading-photos-to-facebook-in-corona/

Naomi
[import]uid: 67217 topic_id: 34847 reply_id: 141557[/import]

Your code is very similar except I’m not using the dialog. But I may be able to set the attachment like I am below with the image added in that I take with the camera and use the dialog like you have. I will give it a try.

One thing is I don’t have to call the login in the code. If I try to call the request without being logged in it will show the login dialog automatically. I will have to see if I need to do this with the dialog routine or not. Thanks again!

 local attachment = {  
 message = field1.text,  
 source = {   
 baseDir=system.TemporaryDirectory,   
 filename="CameraShot.jpg",   
 type="image",  
 },  
 }  
 facebook.request( "me/photos", "POST", attachment )  

[import]uid: 184193 topic_id: 34847 reply_id: 141560[/import]