Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posting replies to tweets #6

Closed
aeikenberry opened this issue May 28, 2012 · 7 comments
Closed

posting replies to tweets #6

aeikenberry opened this issue May 28, 2012 · 7 comments

Comments

@aeikenberry
Copy link

Hey sir, I'm trying to make replies, i've tried putting in_reply_to_status_id in the params, but it doesn't seem to be working.

My post looks like this:

T.post('statuses/update', { in_reply_to_status_id: 206921984414724100,  status: '@ABCDominique Great tweet, that.' }, function(err, reply) {
// things
      });

Any ideas?

@ttezel
Copy link
Owner

ttezel commented May 28, 2012

hey @aeikenberry,

I just ran your exact code above and tweeted at you without problems using the current version of twit. Try npm install twit and re-run your code. Let me know if you still have issues!

@aeikenberry
Copy link
Author

Thanks for the reply. I'm able to @Someone, but the in_reply_to_status_id
remains null, so on twitter.com, the tweet doesn't show as a reply where
you can see what its a reply to.
On May 28, 2012 11:53 AM, "Tolga Tezel" <
reply@reply.github.com>
wrote:

hey @aeikenberry,

I just ran your exact code above and tweeted at you without problems using
the current version of twit. Try npm install twit and re-run your code.
Let me know if you still have issues!


Reply to this email directly or view it on GitHub:
#6 (comment)

@ttezel
Copy link
Owner

ttezel commented May 28, 2012

if you want to get a in_reply_to_status_id, you need to get that first before posting the tweet. You can do something like this for example:

//grab my mentions
T.get('statuses/mentions', function (err, reply) {
  if (err) return console.log('error:', err)

  //tweet will be posted as a reply to the last mention I received
  var id = reply[0].id

  var opts = {
    in_reply_to_status_id: id
  , status: '@tolga_tezel Great tweet, that.'
  }

  //tweet it
  T.post('statuses/update', opts, function(err, reply) {
    if (err) return console.log('error:', err)
    console.log('reply:', reply)
  });
})

@aeikenberry
Copy link
Author

I apologize if I'm doing this way wrong, but when I do this, I do not get an error, however, in the reply, in_reply_to_status_id stays null even if you include this parameter.

Are you seeing this in your reply's reply?

var opts = { in_reply_to_status_id: 207161603534229500
           , status: '@JonaW1995 Great one.' }

T.post('statuses/update', opts , function(err, reply) {
        console.log(reply);
      console.log(err);
      });

Looking at my reply, in_reply_to_status_id is null. Any ideas?

@ttezel
Copy link
Owner

ttezel commented May 28, 2012

Okay so I just ran a lookup on the id you posted above, and it 404'ed (a tweet with that id does not exist). So you're using the wrong in_reply_to_status_id value.

T.get('statuses/show/207161603534229500', function (err, reply) {
  if (err) return console.log('error:', err)

  console.log(reply)

  /*
reply looks like

error: { statusCode: 404,
  data: '{"request":"\\/1\\/statuses\\/show\\/207161603534229500.json","error":"No status found with that ID."}',
  twitterReply: '{"request":"\\/1\\/statuses\\/show\\/207161603534229500.json","error":"No status found with that ID."}' }
*/
})

@aeikenberry
Copy link
Author

Hey sir,

I was just able to do it successfully by using the tweet['id_str'] instead of tweet['id'] as my in_reply_to_status_id. I'm not sure what the difference is on those. id_str is a string, id is a number, and sometimes they're not the same number.

But, i've tested using the string version, and it works well. Thanks for the help!

@ttezel
Copy link
Owner

ttezel commented May 28, 2012

No worries :)

@ttezel ttezel closed this as completed May 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants