Skip to content

Tweet from a JS file #579

@richardstweets

Description

@richardstweets

Does anyone know how I tweet from another JS File ?

My index file looks likes this:

console.log('Starting');

var Twit = require('twit');

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

var tweet = {
	status:'Hello World',
}

T.post('statuses/update', tweet, tweeted);

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

I'm new to this and all I want to do is say tweet from another js file called tweets that say has a list of tweets in it like the below:

'This is a test tweet'
'This is a test tweet 2'
'This is a test tweet 3'

and I want it to tweet them from top to bottom and also with an interval say like every hour.

Can anyone help with this ?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions