How to post a tweet to Twitter AND get its id - ruby-on-rails

I have the Twitter API installed into a Rails app via this brilliant gem: https://github.com/sferik/twitter. I've been posting some test tweets on my feed and all was fine until I realized that I need to also grab the tweet that is sent out and display it on the site.
Use case: When a user signs up, a tweet is sent out. I'd like to display the tweet that was sent out so that they know they've been tweeted.
Is there anyway I can get the id of a tweet when I do $twitter_api.update(new_user_tweet)?
new_user_tweet would be "We are glad to welcome user12450 to the party!". You get the idea.

Related

Some twitter posts have multiple Tweet IDs

I happened to find out that for Tweet post ID (e.g. 804443247653322753), when I try to open the page for this Tweet (through URL like https://twitter.com/PolitiFact/status/804443247653322753), it is automatically redirected to Tweet with different Tweet post ID. (e.g. above link will redirect you to https://twitter.com/PolitiFact/status/804418546168041472). It seems quite many Tweet post IDs can redirect to same single Tweet post. Does anyone know why this happens, or what's wrong with those redirected Tweet post IDs?
As you know, each tweet has an ID.
A RT is a tweet. So a RT has an ID.
The tweet ID 804443247653322753 has been posted by #hrblock_21 and it is a RT of the tweet ID 804418546168041472 posted by #PolitiFact.
So, this is done by twitter, the web site redirects automatically to the original tweet because it is the only tweet to see (except if the user added a comment when retweeting).
And you can even try https://twitter.com/anyUserName/status/804443247653322753, or https://twitter.com/anyUserName/status/804418546168041472, the tweet to see is the original so it redirects.

Error posting content on Facebook using gem (koala) on ROR

In my ruby on rails application i am using Koala gem to post contents like message/link on facebook. But while trying to post its giving following error message:
You've already posted this. Posting the same content repeatedly on
Facebook isn't allowed
I am however posting different content each time.
My code:
auth_token="token" # this token i am getting from facebook graph-api with publish_actions permission.
#graph = Koala::Facebook::API.new(auth_token)
message=#graph.put_connections("me", "feed",:message=> "welcome")
Could you tell me that what would be the exact problem? and how to resolve it?
I just had this problem too, its not an issue with koala its a facebook problem. I was trying to post stuff on my own wall using the facebook graph explorer, I accidentally posted the same message several times. As a result facebook flagged it as spam and as a result blocked all messages from applications from being posted onto my feed.
I had to click on the notification which mentioned 'please check your recent posts and likes to make sure their yours', press some buttons saying that everything was fine, and after that I was able to use the facebook graph api to send posts to my page.
So this problem is caused by posting multiple identical messages to a users account, causing facebook to categorise your app as spammy, from that point onwards even if the messages are different you'll get the same error message.

Check if Tweet was successful

On my website I have placed a tweet button. I want to allow Users to Tweet certain content.
So if a user clicks the Tweet Button and tweets - I want to save the Tweet ID in my database.
How do I get the response from Twitter
that the Tweet was successful
what the Tweet id is
Sorry, no clue how to do that. Any Tips where to start?

Rails - Twitter API: how to get from ID link to Twitter profile?

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...

how to get a response to know if the user has actually tweeted

i have a webpage. on it, i have added a twitter tweet button, available here
http://twitter.com/about/resources/tweetbutton
using this, the user is able to connect via twitter, and also post tweets. another thing possible is that user clicks on the button, maybe even logs in with twitter, but closes the popup without tweeting.
now, i need to get some kind of response to know when the user has actually tweeted. if the user has tweeted, i have to display a message on my native webpage saying 'thank you for tweeting' and IF POSSIBLE, the tweet text that he tweeted.
any ideas?

Resources