automatically get new Facebook posts - facebook-graph-api

I'm writing an app that needs to automatically get a profile/page new posts ( doesnt need to be instant, can be a cron job ). Let's say I wanna "monitor" those profiles/pages.
My question is : If the user is using my app, and I can get Facebook permission to read user_posts, is this possible to keep checking for new posts using cron job ?
2nd question : If user_posts permission is denied by Facebook, is there any other way to accomplish this ?
Many thanks

With User permission it's possible. Refer the following link.
Facebook Documentation
Without user's consent I am not sure if it is possible.

Related

Get instagram ID from facebook graph API without manage_pages permission

I'm creating an app that's using facebook login to get instagram follower insights. Currently I've followed and and successfully made the soloution written here: https://developers.facebook.com/docs/instagram-api/getting-started/
But here's the problem. Facebook won't approve the "manage_pages" permission for my app. Without manage_pages I have no idea how to get the instagram account id.
I've tried for a couple of weeks now, and facebook won't give any explanation other than "This permission is not required for your app's intended function, or it doesn't appear to enhance the user experience" and then referencing this https://developers.facebook.com/docs/facebook-login/permissions
I currently have a facebook support ticket regarding the issue but they haven't replied for almost 2 weeks. And I'm getting a little desperate.
Using below URL for version 3.0 and 3.2 to get the instagram accounts - It works with "manage_permissions" but without it the response is empty.
me/accounts?fields=name,id,access_token,instagram_business_account{id}
Facebook has finally replied to my support ticket and accepted my app review! The approach and guide I was using above was correct.
I have similar problem to get Instagram Id without extra manage_pages permission. I see no point to ask users for manage page permissions (just read it - its includes ads/create/delete etc permissions, crazy) just to get their Instagram accounts id connected to the page. I've found pages_read_engagement permission will provide this data! So, read only permission fixed my problem. Try it! Its better than manage_pages I guess.

Is it possible to send a message to facebook for a user at a later time?

Suppose that a user logged into facebook on my website. On my website they write that they want to send a message to facebook. Then after some time I will log in and click to submit the message for this user.
From what I read so far it seems that this will not be possible but I want to make sure. From what I understood, once the user logs in on my website I get an access token and only using this access token can I send a message to facebook for that user. But I would think that the access token doesn't last for a long time so it won't help saving it in a DB.
Question: is there a way to do the above mentioned functionality?
You might be able to do it through Facebook maybe something like this or maybe look here (similar question, you might find useful answer)

How to permanently connect with fb account?

Hi I want to create a feauture for my cms. It should work like this:
When user publish news on website it will automatically publish a link on Facebook page.
What is the best solution ? Let's say we have one facebook account but multiple website admins. And permanent access token doesnt exists so I will have to do some reauthentication?
Any tips how to make this work will be very apriciated.
Thanks
As of last month facebook removed offline access and the access token you use will work for only 60 days. In order to use it after that period you will have to renew access token every time your user enters your web page or whatever you have.
Take a look at this link
How to renew/extend facebook access tokens with PHP?

facebook graph api: how to use me correctly?

i am trying to use /me/likes/pageID the same way i used pages.isFan (REST API).
But it always uses the user/page as me for which i created the access token and not the current active user.
can't get my head around this one, any help is appreciated!
thanks
[from comments] but do i really need to create an application to "just" check if the user is fan of my own page? and even ask his authorization?
Yes, you will need an app in any case.
If you run your app as a canvas or page tab app inside of Facebook, then you get the info if the current user liked the very Facebook fan page the app is running in(!) directly from the signed_request parameter.
If you want to query this infor for other pages, and/or your app is running outside of Facebook, then you have to have the user connect to your app and ask permission to read his likes first, before you can get this info.
For information on the latter case, see https://developers.facebook.com/docs/authentication/, https://developers.facebook.com/docs/authentication/permissions/#user_friends_perms, https://developers.facebook.com/docs/reference/api/user/#likes
It is easy: With the new Graph API, the owner of the access token is me. You can see this by pasting an access token into the debugger.
You should be authenticating your user and gaining an access token in their name each time they visit your site. Then use only this access token when you make your query.
This process is easiest if you use one of the Facebook SDKs.

Best option to POST on facebook timeline

I need to make POSTs to facebook page timeline (not auto posts, but when a user on an enterprise application submits a form). Note that a user should bot be logged in on facebook!
I've searched a lot and seems i should use graph api to do this... but, it's possible to achieve this without creating a facebook app?
I don't wish any user have this app... i just need to make POSTs to a facebook page that i own. So, it's not a public app.
I've made some tests with graph api explorer, after creating an app, and i'm trying to POST and always get error "An active access token must be used to query information about the current user.".
So, i'm using the correct access token (app access token in this case)... how can i test this? I should have my app submitted to be reviewed already? I just want to make some tests, to see if this actually works as i need to... don't wish to publish app now.
Could someone point me to the right direction?
Thanks!
An App Token is the wrong Token to post to a Page. You would need to use a Page Token for that. At least if you want to post "as Page". If you want to post "as User", you have to use a User Token. Everything you need to know is in the docs: https://developers.facebook.com/docs/graph-api/reference/v2.5/page/feed#Creating
More information about Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/