Added twitter tweet support
This commit is contained in:
parent
29a9b328a0
commit
37928238df
3 changed files with 43 additions and 1 deletions
26
imports/modules/server/twitter.js
Normal file
26
imports/modules/server/twitter.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import Twit from 'twit';
|
||||
|
||||
const confTwitter = (lang) => {
|
||||
const tConf = Meteor.settings.private.twitter[lang];
|
||||
|
||||
const T = new Twit({
|
||||
consumer_key: tConf.consumer_key,
|
||||
consumer_secret: tConf.consumer_secret,
|
||||
access_token: tConf.access_token,
|
||||
access_token_secret: tConf.access_token_secret
|
||||
// timeout_ms: 60*1000, // optional HTTP request timeout to apply to all requests.
|
||||
});
|
||||
|
||||
return T;
|
||||
};
|
||||
|
||||
const tweet = (message, lang) => {
|
||||
const T = confTwitter(lang);
|
||||
T.post('statuses/update', { status: message }, (err, data, response) => {
|
||||
// console.log(data);
|
||||
// console.log(response);
|
||||
});
|
||||
};
|
||||
|
||||
export default tweet;
|
||||
Loading…
Add table
Add a link
Reference in a new issue