Facebook App to Post HTTP GET to Timeline - http

A lot of the documentation online is pre open graph, and I find the Facebook developers documentation quite confusing (I'm a novice developer). Can someone please tell me, at a high level, how or where I might find out how to go about creating an app in Facebook where I can post to my business' page timeline through a single encoded HTTP GET (or similar) request.
I understand I might have to make a simple FB app and authorize it to talk with a separate web app. But I'm just looking at pointers at this stage.

well it isn't quite correct that you can only find pre-open graph things on Facebook. Anyhow, to post, you need an access token.
What you seek to do is update your fan page via app, if I get it correctly.
That isn't done with just one url: you need to call at least two:
1) one call is to authorize the app and get an access token
2) the second call is to get your accounts (fan pages) with ids and access tokens
3) the third call is to update your fan page via app.
The url to post via app would be https://graph.facebook.com/$your_id/feed with the following parameters: access_token, message (the message you want to post, not required), link (if any. Not required.), image (not required), description (not required), caption (not required), etc. You need at least a message or a link for the post. If you use php the easiest is a curl POST call. I've found something for you here, by the way

Related

Is it safe to make a Facebook Graph API Call from the Client using a Page Access Token?

I want to call Facebook's Graph API from the client to READ public posts on a page using a permanent Page Access Token. I'm curious if this is safe (or how to make it safe). From everything I've read and tried, an access token is required to perform this operation and none of Facebook's other functionality will suit my needs (see background below).
https://developers.facebook.com/docs/javascript/reference/FB.api/ suggests that it is safe to expose Page Access Tokens to the client, but I'm suspicious they're lying to me.
Background:
I'm working with a group that wants to display some posts from their Facebook feed on their WordPress website. They don't want to display all posts, but rather filter them based on a hashtag. I don't know a ton about WordPress, but I'm guessing I can't implement custom back-end API calls on a WordPress site. Please suggest any alternative solutions that you might have!
Access Token are like house keys, you NEVER leave them in front of the door. Which means, you should NEVER hardcode any Access Token. No matter if it is an App, Page or User Token. The docs do not state anywhere that it is ok to expose tokens, they just state how you can use a Page Token on that page in your question - but you cannot just hardcode it on the client.
Vulnerabilities: Without extra permissions, this would be more like a privacy issue, because you can get a lot more info with a Page Token (as the Page owner) than with a simple App Token.
Of course it is possible to do that kind of backend-calls with wordpress. And it would be the far better way, i think.
First you can use the WP-Cron to time your Facebook-Calls. You could create a Cron-Job every hour or so.
WP Developer Scheduling WP Cron Events
Wordpress Codex wp_cron Function Reference
Kinsta Knowledgebase Wordpress Cron Job Tutorial
If you work first time with the WP-Cron have one thing in mind: WP-Cron depends on Site-Activity to be run. So if there is no Traffic on the Wordpress-Site, no Cron-Jobs are run. Here is a link how to add WP-Cron to your systems cron, so your API-Call will be called every time you intend to:
WP Developer Hooking WPCron into System Task Scheduler
The Cron-Job than can use the Wordpress HTTP API to do the call. You should check the Docs on the HTTP API and the wp_remote_request function in special.
Wordpress Codex HTTP API
WP Developer wp_remote_request Reference
Or you could install the Facebook SDK with your Theme/Plugin.
I'm not sure about the security impacts when using a Page Access Token on the Client, but it seems to me, that it would be a better way to do that kind of job.

bit.ly numbers not reporting QR scans

So we're doing some tracking and I've setup some links to be tracked via bit.ly. I've also created some QR codes.
So, we scanned the codes using QR Reader, the #1 QR scanning app on the app store, and none of the hits were coming in through bitly. So we decided maybe it had to do with the fact that I made bit.ly links and then made QR codes from those, rather than using bit.ly's built in QR code creator (which we just found). Tried with the new codes, still nothing on bit.ly's site.
I downloaded a different scanner (QR Scanner) and it records everything as normal.
Does anyone have insight into this, done this before, know of a work around? I can't force my users to not use a particular QR scanner.
I mean, unless I'm crazy, when I hit a bit.ly link, their server goes and looks up what the URL is based on the code and redirects me. How the F! can that process happen without bit.ly recording the event?
bit.ly is not a reliable way to get usage statistics for a URL.
For best results, you should use the facilities provided by the web server itself.
Since you don't control bit.ly you can't control how they count hits.
I believe the QR Scanner program is performing a HEAD request instead of a GET request to validate the URL scanned. Since a HEAD will return re-direct information and is not (and should not be) counted in "hit" statistics you wouldn't see the hit on the bit.ly statistics.
While frustrating for your goals, this is one of the features that make QR Scanner better than other programs, you don't want to do a full GET when a HEAD will work.
Merely scanning a QR code containing a URL does not necessarily do anything to the URL. A simple app would do nothing at all. It would show the bit.ly URL to the user and wait for the user to confirm that he/she wants to access the URL. Then of course the browser would access the URL.
Some apps like Barcode Scanner on Android will access known URL redirectors to show the user what's behind the redirect before proceeding. It will issue a HEAD request after just scanning the QR code.
I would not expect any app to issue a GET just on scanning. It's unnecessary to read the redirect. And if the app is sending the user straight to the URL after scanning, that's a bit of a security risk.
A couple of things to check would be GET/HEAD and the User-Agent. If the QR reader is sending a strange, or no, user-agent header, it might get accidentally considered a bot click.
If you generate a bitly link - http://bitly.com/test - and then turn it into a QR code using a 3rd party service, you won't see any stats about whether scans have come from a QR code.
If you use the bitly QR generator - http://bitly.com/test.qr - you will get a QR code with a different url in it.
In this case
http://bitly.com/test?r=qr
It is that r=qr part which is recording whether the click came from the QR code.
So, to clarify, you share the link "http://bitly.com/test" on Twitter / Facebook / etc. You share "http://bitly.com/test?r=qr" via QR code. That way you can track where hits are coming from.

How to process a google-checkout "buy-now button" transaction?

Google-checkout has a wizard that creates the html code for the button, but how do I have my website get confirmation that the transaction has been completed (or that it wasn't)?
EDIT: I have already seen pages such as https://developers.google.com/checkout/developer/Google_Checkout_HTML_API_Notification_API#Receiving_and_Processing_Notifications and the like. But I don't know how to implement them. For example: what is "HTTP Basic Authentication" , "HTTP request headers" , "HTTP 200 response code" , "POST" , etc.
So what I need is a simple (!) example with minimum code.
You would have to implement Google's Notification API. You can read about it here: Implementing the Notification HTML API.
Edit
In Response to:
Thanks. But unfortunately I don't know enough web developing to know
how to apply what is written there.
I'll be honest with you. Simple is relative and if you aren't familiar with some of the fundamental concepts as POST and request headers, it's likely you will never get a simple response.
Having said that, I believe the simplest solution for you is to manually confirm the transaction upon receipt of the confirmation email.
I envision that you would have some sort of management screen that displays a list of all 'pending' transactions. When you receive your confirmation email from Google, you would simply mark the corresponding transaction as having been completed. This is not entirely uncommon. In fact, since you are using single-item purchases using the Google button, this is probably the best option for you.
A more complex scenario (again not a simple solution), would be to create a service that will parse your emails and using some voodoo to map those emails to the corresponding transaction in your web app. This, though, is probably as advanced as implementing the Notification API.

Techniques to Trigger Google Analytics Tracking from PDF Links

Here's the scenario:
I have a mailing list that contains a PDF download link. The PDF contains ads with clickable links. I need to get analytic data on the link clicks - preferably via Google Analytics (due to the richness of information available).
The solution I have in mind is for the link to go to a web page that I host with some sort of ad-specific token. GA records the request and then I use a client-side technique to redirect to the actual target URL. The redirect page serves no purpose other than to track the click and so I'm not worried about it being perceived as cloaking by search engines.
What I want to know is:
Are there any alternative ways to achieve the tracking without using an intermediate redirect page (could I perhaps call GA server-side somehow)?
If I do use the redirect page approach, what are potential pitfalls could I encounter?
Thanks in advance for any advice.
dunno what server-side environment/language you use but for instance in php you can use cURL to send an image request to google, with the custom code appended to the url. Easiest way to do it is to output the code with javascript with your custom code and then capture the image request url with a sniffer, so you can replicate the format for your cURL request. Make sure to send header info, including fake browser info so GA doesn't weed it out as a bot. Then forward to the ad url. That way you don't need to output a page.
Yeah you still have a 'redirect' happening but you cut out having to have the client download a page or worry about javascript being disabled, etc...
unfortunately there really isn't anything better you can do.

Send Facebook message from application

How can I send a message to the currently logged in user from inside a Flex application contained in a Facebook iFrame and using the official AS3 Library for Facebook please?
To date the Graph API is the easiest way to work with facebook.
http://code.google.com/p/fbas/
It's far from a complete implementation, but Graph is so simple it shouldn't take long to implement any features you need.
NOTE: When I've used it I ported the javascript portion of the example code on the project's main page to AS3 & ExternalInterface. It reduced external dependencies to zero (with the exception of swfobject)
Facebook does not allow you to send messages . Either way , you can post to the user's friends feed on behalf of the user , with a custom message and the the notification for the post in feed will be displayed.
Post your request to http://graph.facebook.com/PROFILE_ID/feed
Requires the publish_stream permission.
You can refer this link http://facebooksdk.blogspot.com/2011/04/facebook-album.html

Resources