Confused about Twitter Javascript API - javascript

The samples I do find online are all about using the Twitter button.
Reading the Twitter Post API it's not clear where to place the code. It seems they are just telling the params expected, but not how the code should look like
I'm soooo confused with this API (:
Well, my need is to place my on my own website my own button. When the user clicked on it, I want to call my a Javascript function that should do the following:
1) Check if any user is logged in
2) Login, if not
3) Check if my Twitter App is already installed on the logged in user
4) Request permission, if not
5) Post a message on his timeline
In fact, I don't even know if I need a Twitter App in order for people to post on their own timeline from my website?
Anyhow, I'm looking for something I can put on a single JavaScript function and that does not involved any Twitter specific button.
I would imagine this to be the simplest of any Twitter APIs but somehow all samples I keep finding online refer to use the Twitter button.

Related

How can I add the ability to extract and post tweets onto the site when user submits link?

I'm making a rails application, I want users to post their tweets by submitting a link [of the tweet]. I'm guessing its done with javascript/twittera api. Things needed to be extracted:
tweet owner
tweet + image
link to user profile page
Twitter REST API requires oAuth authentication. So, you would have to provide access token with all of your API calls. oAuth specification allows you to get access token through javascript as well. So you might want to look into that.
If you decide on using REST API, I would suggest moving this to server-side. You would be able to save user tweet urls and data.
Alternatively, if you are just playing with javascript and want to do this for yourself, you can simply see in your browser's developer tools where official Twitter widgets are getting tweet data and use that edges. I remember myself doing this several years ago.
But, please note. These urls are not public and official way of working with twitter data. So, they may change at any time and break your code.

Writing a comment onto a 3rd party facebook wall via website link

Really wracking my brains about how to do this but i basically dont even know where to start.
Basically twitter has functionality that allows a link to open a twitter box that a user can populate and then post directly onto a chosen twitter feed:
https://about.twitter.com/resources/buttons#mention
Its super simple, all it requires is changing the URL parameters of the target link.
Im trying to do something similar with facebook. Ideally a link clicked on my site would open a facebook page with a prompt for user to type their comment and login to post to the 3rd party wall. I definitely do not want to be handling any FB authentication on my end as i imagine this would be far beyond my rather novice coding abilities.
An alternative would be to capture the comment with a text box on my end and then pass this through to facebook to write onto the wall.
Ive trawled the net and stack exchange looking for solutions but most seem to be geared to putting a comment on the users wall rather than a 3rd party.
Honestly im not super active on any social media anyway so my knowledge of how they function is quite limited. If anyone could give me a steer and some possible solutions (or alternatively just out and out that it is impossible) that would be fantastic.
You can use the Facebook JavaScript SDK, and invoke the feed dialog using that.
The feed dialog has a to parameter into which you can fill the Facebook ID of the profile that you would like the user to post to. However, the profile who's ID you fill in there must have authorized the same app as the one that you initialized the SDK for. That means this approach is likely impractical.
In any event, here's a piece of example code.
If you would like to use graph API to post to a profile's timeline (using the profile-ID/feed POST endpoint), you'll have to implement Facebook Login as well. However, since Graph API v2.0 is mandatory for all apps now, you can only find those profile IDs of people who have also authorized the same app.
This is probably even less practical for you, given that you don't want to implement Facebook login.
As far as I can see, these are your only options to achieve what you are looking for at this time.

How do I make Facebook like-detection work on my website?

I have built a simple webpage in PHP. I want to tell if users like my page (I placed a like button on it). It is not a Facebook app. I have seen this, but don't know how to use it with PHP. I don't know JavaScript at all. I tried pasting the code listed at the link into my page, but it didn't do anything useful.
A PHP solution would be preferable. I don't want to build a Facebook app, I just want to know if the Like button has been pressed.
Any help would be appreciated. Thanks!
Edit: Here's the link to my website, per answerer request: testingground.comyr.com
Those Edge events are only usable to detect if the user clicked the Like Button right now, but you cannot check if he already liked your page. That is only possible with an App, and user authorization with the "user_likes" permission.
More information:
Check if logged in user has liked my Facebook Page
Check if user liked page or not
Why don't you use the Facebook developer reference documentation?
Without an API Access, I think there is no possibility to do that.
How should you have access the private token what a random user liked?

Creating a facebook likebox

A client of mine (a design studio) asked me to style the like-box social plugin on their site.
As far as I know this cannot be done now with the deprecation of "css" parameter on the fbml tag.
So the route I have to take is to recreate the like-box myself using the js SDK (or php SDK), but the problem is that I cannot find the users (and their photos) that like my page. I'm searching through the opengraph explorers parameters but i cannot find anything.
Does anyone know which url I must follow in the graph api to get what I want?
Do I have to have an access token for such an action? I noticed that the likebox plugin works event if you don't have a facebook account (It shows pictures).
Thank you.
You can't recreate the like box on your own. The Facebook APIs will not return a list of users who like your object. This was done to stop people from getting user lists of likers and spamming them.
Currently, you can only query to find if a specific, authenticated user or which of their friends likes your object.
You could build something similar by populating your fake like box with images of recent posters. You would need to deal with filtering out duplicates, and the page posting as itself, but this should get you started: /PAGE_ID/feed?fields=from.name,from.picture&limit=10
You will need an access_token to get this data. I'd authenticate as an app to do it.

Sending facebook business page invitation via request dialog, recipient receive nothing

I'm new to facebook development and have done a lot of research and start getting my head around, i've come to realised that many coding implementation available online were using FBML which will be discontinue very soon, not much luck to find resources or tutorial for the iframe methodology.
At this stage what am i trying to do is to put a button on a business page when user clicks a friends invitation pop up will be appear on the screen. What i found from developer.facebook.com was the following link:
http://developers.facebook.com/docs/reference/dialogs/requests/
by using the request2.0 javascript sdk to trigger the pop up and send invitation to users. I followed the tutorial as stated and has been successfully get the pop up dialog box shows, after selected friends that i want to invite i clicked send then the window closed. (i used the function "sendRequestViaMultiFriendSelector()" and did nothing on requestCallBack as shown from the example.) and the X account did not receive any invitation or notification of my invitation at all.
I also read:
Link 1
and
Link 2
I tried to understand but i got confused by the mix of php and javascript in certain stage.
Would be appreciate if anyone could provide me some explanation (or links for me to read if you are lazy :-D)
***Note: Please be aware that i'm not asking a question without doing any research. I have experienced with asked by a developer/user to create my question instead of asking under his post. And thats why i wrote this.
Thank you for your time to read my post.
I've recently tried the same thing as you did and i've been successfully sending request but whenever user click on the invitation link, it directs user to a page with full canvas like at apps interface. I got this work by attaching the url into canvas under apps setting at the configuration page

Categories