TwitterJSClient
TwitterJSClient copied to clipboard
Keep Getting Use Require Error
Module name "twitter-node-client" has not been loaded yet for context: _. Use require([])
I am trying to use this in a Office 365 Addin and followed the instructions.
(function(){
'use strict';
// The Office initialize function must be run each time a new page is loaded
Office.initialize = function(reason){
jQuery(document).ready(function(){
app.initialize();
displayItemDetails();
});
};
// Displays the "Subject" and "From" fields, based on the current mail item
function displayItemDetails(){
var item = Office.cast.item.toItemRead(Office.context.mailbox.item);
jQuery('#subject').text(item.subject);
var from;
if (item.itemType === Office.MailboxEnums.ItemType.Message) {
from = Office.cast.item.toMessageRead(item).from;
} else if (item.itemType === Office.MailboxEnums.ItemType.Appointment) {
from = Office.cast.item.toAppointmentRead(item).organizer;
}
if (from) {
jQuery('#from').text(from.displayName);
jQuery('#from').click(function(){
app.showNotification(from.displayName, from.emailAddress);
});
}
debugger;
//Callback functions
var error = function (err, response, body) {
console.log('ERROR [%s]', err);
};
var success = function (data) {
console.log('Data [%s]', data);
};
var Twitter = require('twitter-node-client').Twitter;
//Get this data from your twitter apps dashboard
var config = {
"consumerKey": "z3qgwIah7X8dWA8O2ktwqQ",
"consumerSecret": "j8f3g03UImTrl2wb0aUvS7Qj062PmHGHNoBix1VmYgYm",
"accessToken": "18077593-47K5rni1FLI9DmHlKEIW9tYSPHCaWpGNZ8U",
"accessTokenSecret": "EohjUdkNWx4fHcNYlklKYnTu5j0rNY3VAnmjLIq "
}
var twitter = new Twitter(config);
twitter.getSearch({'q':'#haiku','count': 10}, error, success);
twitter.getSearch({'q':'#haiku','count': 10}, error, success);
}
})();