I'm trying to integrate twitter into my site in a way that allows me to give a member of my site 'points' for tweeting about the site. Everything is working so far, except I can't figure out how to ensure that the user is actually saying something related to my site.
Basically, once the user submits a tweet, I would like to verify that the tweet contains my hashtag. The rest of the text can be whatever they like, but I don't want to give them points if they delete the hashtag from the tweet.
I'm using the javascript tweet button, and I put my code for assigning points inside of
twttr.events.bind('tweet', function(event) { ... });
How can I check what the user tweeted?
Thanks!
Related
I have a like button on my own website, and I want it to function just like it currently does, with the additional feature that it also makes a post on the person's facebook timeline "John Smith liked this post on www.example.com" where www.example.com is my website. How can this be achieved?
Facebook has documentation for how to put their own like button but I don't want theirs, I just want what I already have to have that one functionality.
First of all, you are not allowed to use custom graphics for the Like Button, you MUST use their own one.
You can use og.likes to create your own Like Button: https://developers.facebook.com/docs/reference/opengraph/action-type/og.likes
A message about the User having liked something shows up automatically on Facebook, you can't "autopost" it additionally. It would require to authorize a User with the publish_actions permission, and it will definitely not get approved by Facebook because the message parameter must be 100% User generated:
Don't prefill captions, comments, messages, or the user message parameter of posts with content a person didn’t create, even if the person can edit or remove the content before sharing.
Source: https://developers.facebook.com/policy/
If you know how to put their button on your page, you should also know how to put your own button on your page. It should be as easy as changing code between
<a href...>
and
</a>
I just googled 2 min and came up with this:
https://developers.facebook.com/docs/plugins/like-button
It says: Use this URL in an iframe or as a link to your plugin.
http://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fyoururl.com&width&layout=standard&action=like&show_faces=true&share=true&height=80
Just change yoururl.com to whatever it should like.
I am working on one social network application. In this application user can put comment like they did in Facebook.
If user enter any external link as comment, i want to highlight that link and if somebody click on it so it need to get open in other tab.
If user enter any link or URL in comment box i want handle it like Facebook did
How i can achieve this
Here's the link to find proper URL:
What is the best regular expression to check if a string is a valid URL?
Also once you get to know it's a proper url, wrap it in an anchor tag and add target=blank property to it.
What I'm trying to do is pull in the feed from two facebook pages and display all the posts on my page. I was able to do that successfully using the Graph API and pulling the posts as JSON objects.
Next I wanted to add the Facebook Like button to point to those posts and have it add the like to the current number of likes on the post. So far I've been able to get it to work with posts of status_type mobile_status_update and added_video by dynamically generating a Like button using the url in each post object as the href for the Like button.
Like this:
like = '<fb:like class="fblike" href="'+value.actions[1].link+'" colorscheme="light" layout="standard" action="like" show_faces="false" send="false"></fb:like>';
This doesn't seem to work on posts of type added_photos and shared_story though. If I try clicking the Like button for the added_photos it will 'Like' then 'Unlike' immediately, registering nothing.
Basically my question is if there is a way to make a Like button on an external site that will update on Facebook?
Thanks in advance for any help you can offer.
I am creating a Google chrome plugin that injects a button onto all Facebook articles/posts. On click, i would like to query the graph API that Facebook provides and receive the post that the button is injected onto from Facebook.
Does anybody know how to do this or if this is even possible?
I have tried just using JavaScript to search the HTML that the button is injected onto and navigate through the HTML elements in order to find the text content, but this gets very messy quickly.
I was just wondering if somebody knew if the HTML elements contain some sort of identifier that will allow me to query the graph API and receive the specific post im looking for. The HTML does contain the users username but not the specific post ID.
Thanks for reading.
I haven't touched the Facebook graph-API, but if you're just looking for post ID's from the home page on Facebook you can do a simple document.getElementsByClassName("uiStreamSource") and then get all <a> elements inside. The last part of each href always contains the specific post ID.
I have added a facebook button to my company's site so that people can quickly distribute surveys to users via facebook. It is a pretty simple JavaScript:
function SFace()
{
window.open("http://www.facebook.com/sharer/sharer.php?u=[[:SurveyUrl:]]","Facebook","width=700,height=300,toolbar=0,resizable=0");
}
<img src="http://www.snap-surveys.com/test/face.jpg" onClick="SFace()" />
It works fine, but people want a customized title to appear. So, I added &t=Something, however, when you click the link, it still just shows the long URL. I thought maybe it was because I wasn't using encodeURIComponent. So, I added a variable
var SFace="http://www.facebook.com/sharer/sharer.php?u=[[:SurveyUrl:]]&t=something"; document.write(encodeURIComponent(uri));
And then using that in the function. Same thing, shows the URL and not the title. What exactly am I doing wrong? How can I get it to show a custom title in the shared link?
In case anyone wanted to know my solution:
First needed to get an App ID from Facebook (get the developer's app, create a new app and set the URL as the base/common domain for the site with the button you are adding). Once you have the ID The URL is:
http://www.facebook.com/dialog/feedredirect_uri=THE_URL&app_id=YOUR_APP_ID&link=THE_URL_YOURE_LINKINGTO&name=TITLE_YOU_WANT_TO_DISPLAY
My recommendation is to write the full URL out like normal and create a variable with document.write(encodeURIComponent); like in my example above. This will add the appropriate spacing characters.
If the URL matches the URL listed in the App, you can have a share link with a custom title and can therefore use your own button and not the default Like button that facebook provides.