Facebook request - php

I have a cool canvas application on Facebook, and sometimes there appear some cool news, some of them are really important, and i wanna notify users of my application about the news by request.
I just wanna them see some numbers of request from my application with a shortcut to my application on their page.
How can i do it in php without any js ?
Thanks!

Request publish_stream access permissions and your app can post to the user's wall using Graph API's /me/feed. There's lots of examples of how to HTTP Post.

Related

I can't post a message on Facebook Wall with my application

I'm trying to make an application that shares the content of my website automaticly whenever a post is posted. So I started with Graph Api Explorer. I got an access token of application Graph Api Explorer with manage_pages and publish_actions permissions.
When I use Graph Api Explorer it posts the message as page post which is I want it to be but when I use my own test application with the same permissions and query structure it posts it as fan post. Please help me what is wrong. Here is some screenshots that will help me to tell the problem:
and the result is:
Perfectly fine! But when I try to do it with my own application,
the settings are the same as above
and the result is:
By the way my application isn't approved becuase I didn't submit an approval. Is this the problem?
No, application approval is not necessary. You just need to use access_token of your page not of your profile.
$facebook->api("/PAGE_ID?fields=access_token");

Show website activities on Facebook timeline?

How can I show website activity on the Facebook timeline?
I integrated Facebook API and Facebook Connect. Now, if any new user uploads a video on the website then I want to display this activity on the Facebook log. What function of Facebook API can I use for this?
You should use Open Graph Actions and Objects. I recommend you create:
A video object
An "uploaded" action as well as utilising the built-in "watch" action
There is a full and more than helpful tutorial right here. Things to consider:
You need to request publish_actions permission from users of your website, if you are already using Facebook Login, then this is a simple matter of adding it to the list of Permissions that you are requesting
Publish an uploaded action for every new video uploaded, make sure you get explicit consent from the user to do so, so that you can use the fb:explicitly_shared parameter.
Use the watch action for any videos that people watch on your website.

Publishing user's activities from Facebook App

I am developing a Facebook application, and I am trying to publish the users' activites in my application in the user's wall, like when the user comments on post, the story feedback appears in his wall and is available to his friends to see
I have read these tutorials:
https://developers.facebook.com/docs/opengraph/tutorial/
As well as the following threads:
How to publish Actions to Facebook Graph API with parameters in call URL
Facebook- Publishing a story to user's wall
I am confused about which one I should follow because openGraph seems a bit complicated to implement....so what is the best practice to achieve my requirement?
If you want to post activities on users wall, open graph is preferred way and you will get large distribution(marketing) also.
You can use the PHP Official sdk from facebook, which makes you job easier.
To post open graph actions, you should take publish_actions extended permission from user.
or
You can post on user's wall using /me/feed method requires [publish_stream][3] extended permission.
SDK tutorial
https://developers.facebook.com/docs/reference/php/
Open graph sample application
Download Social Cafe app and see their code
https://developers.facebook.com/docs/opengraph/samples/
You can use Javascript SDK as well, and sometimes that is actually getting better. For example, recently Facebook enforces that users have to read for at least 10 seconds before the app publishes news:Read. These are the usecases that can be handled very efficiently with javascript sdk and jquery (or similar client-side technology).
As for April 2018,
The publish_actions permission is no longer available.

Post on user's wall with the Application

Is there any way to post on user's wall as the Application and not as user?
It's hard to provide a definitive answer without some more context as to what sort of post you want to do, but the answer is probably no.
We dont provide a a mechanism for pages or applications to write on a users wall directly.
As a Page, you can post on your wall, and the messages you write will be shown to a subset of the users who have liked your page in the news feed.
As an application you can use stream.publish to post on the users wall/timeline with an application attribution. But it's not as the application per se.
With Timeline Apps you can use the Open Graph to publish actions the user has taken with your app, like Spotify does. So you're posting what the user has done with your app, rather than posting as the user.
HTH

Posting to User's walls as application using Facebook PHP API

I've been building a web app that uses facebook integration for easier registration/login and notifications for the users. However, for the notifications I want to be able to post to a users facebook wall when something happens on our site.
Really I see two possible problems with doing this. First being that the user will most likely not be logged in to our website when the notification needs to happen. Second I have not found a way to post to the feed using any identity other than the current logged in user.
So to reiterate exactly what I'm trying to do. When some action takes place on my site involving Bob, I want the websites application to post on Bobs wall notifying him of the action as if the application is one of Bobs friends. From some of the things I've seen while researching this, it seems as if facebook might not treat applications like users and I might have to go through a page to accomplish what I want. But really I'm ok with that.
What you need to do is to ask for the offline_access permission. Then you can store their graph id property after they login/authorize to your site's database. Then you just post to that graph id instead of instead of /me. In your case you would then POST a request to the "$user_graph_id/feed" endpoint with whatever parameters you usually have.

Categories