Reputation: 17640
Ok so I thought I would find the answer I was looking for with a search but maybe I'm just not understanding things, so here goes.
I want to run status updates to my twitter account using javascript only my code runs on top of node.js so there is no html or php strictly javascript. So a text box is out php is out.
I've searched around and can't seem to find a solid example where I can just post using ajax or something to update my status can someone please point me in the right direction ?
Upvotes: 0
Views: 730
Reputation: 7514
Have a look at Mikeal's Request module. You can send a POST request as follows:
var request = require('request');
request.post({
url: 'https://dev.twitter.com/docs/api/1/post/statuses/update',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
status: "Your new Twitter status"
})
}, function(error, response, body){
console.log(body);
});
Note that this example is not complete as you would still have to authenticate to Twitter.
Upvotes: 1