I've added a "tweet this" link to a site. It uses the url to update your Twitter status (if you're signed in). Basic version is as follows:
Twitter
You can see it in action here - http://jsfiddle.net/CXzf9/1/ - right click the link to open in a new window (need to be logged in to Twitter first).
Works fine except on iOS devices. Then it gives you an error saying "Sorry that page doesn't exist". You can also see this using Safari when set to the iPad user agent. It redirects from
http://twitter.com/home/?status=TEST STATUS
to
https://mobile.twitter.com/home/?status=TEST STATUS
But it's not that causing the problem, as if you visit that link in Safari (with the usual user agent) you get the mobile version, but it's still allowing you to update your status.
Is this some iOS restriction?
UPDATE - VISUAL EXPLANATION:
This is visiting mobile link in Safari:
This is same link with user agent set to iPad:
OK, seems it works if you use the following url:
https://twitter.com/intent/tweet?text=
So original code would be:
Twitter
Must be some iOS restriction on updating a status for some reason.
after trying on my iPad, I got undefined as the title and text saying "something went wrong". if this is what you are receiving, then it's because twitter does not have a mobile version of this page. Hence "mobile.twitter.com". I would recommend using the twitter api (here) to update a uses status.
Official Twitter documentation about creating post links:
https://dev.twitter.com/web/tweet-button/web-intent
Web Intent URL
https://twitter.com/intent/tweet
Query parameters
text (optional)
Pre-populated UTF-8 and URL-encoded
Tweet text. The passed text will appear pre-selected for a Twitter
user to delete or edit before posting.
The length of your passed Tweet text should not exceed 140 characters
when combined with any passed hashtags, via, or url parameters. Passed
Tweet text which causes the Tweet to exceed 140 characters in length
will require additional editing by a Twitter user before he or she can
successfully post.
Example Value: Hello%20World
url (optional)
A fully-qualified URL with a HTTP or HTTPS scheme,
URL-encoded. The provided URL will be shortened with Twitter’s t.co to
the number of characters specified by short_url_length.
Example Value: http:%3A%2F%2Fexample.com%2F
hashtags (optional)
Allow easy discovery of Tweets by topic by including
a comma-separated list of hashtag values without the preceding #
character.
Example Value: nature,sunset
via (optional)
A Twitter username to associate with the Tweet, such as
your site’s Twitter account. The provided username will be appended to
the end of the Tweet with the text “via #username”.
A logged-out Twitter user will be encouraged to sign-in or join
Twitter to engage with the via account’s Tweets. The account may be
suggested as an account to follow after the user posts a Tweet
Example Value: twitterdev
related (optional)
Suggest additional Twitter usernames related to the
Tweet as comma-separated values. Twitter may suggest these accounts to
follow after the user posts his or her Tweet.
You may provide a brief description of how the account relates to the
Tweet with a URL-encoded comma and text after the username.
Example Value:
twitter%3ATwitter%20News,twitterapi%3ATwitter%20API%20News
in-reply-to (optional)
The Tweet ID of a parent Tweet in a conversation,
such as the initial Tweet from your site or author account.
Example Value: 525001166233403393
Example post link: https://twitter.com/intent/tweet?text=Hello%20World&via=twitterdev
Related
According to the official documentation, the related parameter is:
A comma-separated list of accounts related to the content of the shared URI.
But what exactly does it do? When the tweet is sent, the added twitter accounts are never included within the tweet message. And they do not receive a notification either about the tweet.
You will only see the related accounts after you've interacted with the tweet button.
Suggest additional Twitter usernames related to the Tweet as comma-separated values. Twitter may suggest these accounts to follow after the user posts their Tweet. You may provide a brief description of how the account relates to the Tweet with a URL-encoded comma and text after the username.
https://dev.twitter.com/web/tweet-button/web-intent
User hits the button, user posts tweet, user sees the accounts you added in the related field.
I want to use the Instagram API to show my own content on my own website. I can see in their documentation that content owners can display up to 20 pieces of media on their site while the app is in Sandbox mode.
I've created an app on my account and I am trying to use their Client Side Implicit Authentication to generate an access_token.
I hit this URL and login to my account:
https://www.instagram.com/oauth/authorize/?client_id=MYCLIENTID&redirect_uri=www.mysite.com&response_type=token
When I submit the login form, I am brought to an Instagram 404 page that says:
Sorry, this page isn't available. The link you followed may be broken, or the page may have been removed. Go back to Instagram.
What am I missing? Do I even need an access_token? Before they changed their API last November I was able to use just the client_id in my requests. I suppose that's not possible anymore?
I think you need to include http://.../ for your redirect_uri. So it would be: https://www.instagram.com/oauth/authorize/?client_id=MYCLIENTID&redirect_uri=http://www.example.com/&response_type=token
But of course that means you will also need to add http://www.example.com/ as the Valid redirect URIs in "Manage Clients" on Instagram.
I am building an IOS app that will post weblinks to facebook and other social media using social media framework (not facebook-graph-api) and it works as I desire. eg:
http://example.com/page1.html?code=123456
I do however want that when my friends on facebook open that external link and it opens in an external browser - their facebook user name gets passed on to the browser so I can allow them to add comments to the weblink.
To clarify - the comments to be added will be on my website for the page they just opened (and not the comments in facebook)
Is it possible to do this ?
You can only do something with URL while posting it. Well if we posting URL on wall of known user then we can achieve your problem with following approach.
I think you can append name of friend as a get parameter in URL. So whenever your friend opens this link, its corresponding name is also passed along with URL. As far as security is concerned you can consider to append some security code to URL as well. Which will be validated against Name of friend.
For example.
http://facebook.com/?Name=Friend_Name&SecurityCode=Some_Unique_Code_Based_On_Friends_Name
I've just looked online but couldn't find the answer:
Is it possible to include a link in an HTML e-mail, so that when a user clicks it, it takes them to post a pre-defined text on their Twitter account, e.g. "#username #hashtagterm This text comes up automatically for me to tweet"?
I guess that if a user isn't logged in, they'll have to go past the login screen and then arrive at the page where they can send the tweet, right?
As I said, it needs to work reliably in an email, so I guess it shouldn't have any javascript associated with it.
Thanks for any help.
Try this, replacing the text with what you want:
https://twitter.com/intent/tweet?text=this+is+a+test
See intents
From the Twitter API I obtain user's ID (of course beside profile link, username etc). How can I display the link to user's profile according his ID?
For example, Facebook API provide user's ID as well, and if I put to the browser www.facebook.com/users_id, I'll get his profile...
Is there any way to do with Twitter? www.twitter.com/users_id returns empty page...
EDIT: obviously I can save user's URL (or his username), but the respective user can whenever change it...
what do you call a twitter "profile" ? I guess you talk about the user timeline
according to the api doc, your url should probably look like this :
https://api.twitter.com/1/statuses/user_timeline.html?&user_id=(your_id_here)
however, i would advise to use one of the twitter api gems to ease your pain...