I'm trying to import this package: https://www.npmjs.com/package/twitter-node-client inside Kibana to query Twitter API. I need an advice on how to structure this, because if I simply 'npm install' library I've trouble with webpack/browserify modules dependancies.
First of all, is it possibile to use that twitter client inside Kibana? How to organize code (like front or backend)?
I really appreciate any help.
Hi @Brandon_Kobel Yes I'm creating a custom plugin, but I'm faceing problem importing that library. When i require it in my controller Kibana fail during bundleing (maybe it's a problem wit hwebpack and depandancies). I think the problem is the oauth library, I have this fatal error:
Can anybody help me?
@valereds By what I understand, You have followed these steps -
- adding the dependency for 'twitter-js-client' library in your plugin's package.json.
- Installing Node modules.
- In your plugin's controller (used to render front-end using angular / js/ jquery), you have added the require statement (var Twitter = require('twitter-js-client').Twitter;)
Now when you try to run the plugin, it fails and gives you the error message.
The problem in the above code is that you are trying to use the 'Twitter' Api from the front-end controller which is not possible, The require statement and twitter commands are to be written in your backend code using node js.
In other words, I think you would need to create an Api from your controller (angular / js) that connects to the nodejs backend and the twitter code can go inside the nodejs backend api function.
Let me know if it helps!
Hi @purisahil41, thank you for your answer.
I solved moving twitter module into the server side of my custom plugins, and I wrote a list of endpoints to call rest api.
Thank u again for your advice!
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.