Node reply script for twitter does not actually reply


This twitter script can currently tweet the selected user once they tweet, but instead of actually replying underneath the tweet, it tweets it as a standalone new tweet. How can I get it to actually reply instead of make a new tweet? I'm using Twit API:

Here's what I have:

    console.log('The bot is starting');

var Twit = require('twit');

var config = require('./config');
var T = new Twit(config);

//Setting up a user stream
var stream ='user');

stream.on('tweet', tweetEvent);

function tweetEvent(eventMsg) {

   var replyto = eventMsg.user.screen_name;
   var text = eventMsg.text;
   var from = eventMsg.user.screen_name;

   console.log(replyto + ' '+ from);

   if (replyto =='other user's handle') {
    var newtweet = '@' + from + ' Hello!';


function tweetIt(txt) {

    var tweet = {
     status: txt
     }'statuses/update', tweet, tweeted);

    function tweeted(err, data, response) {
      if (err) {
        console.log("Something went wrong!");
      } else {
        console.log("It worked!");


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.