Twitter client inside kibana plugin (app or vis)


#1

Hi all,
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.
Thank you


(Brandon Kobel) #2

@valereds you'll be creating a custom Plugin to do so, please see the following topic for some helpful resources: Creating custom kibana plugin


#3

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:


#4

Can anybody help me?
Thanks


(Purisahil41) #5

@valereds By what I understand, You have followed these steps -

  1. adding the dependency for 'twitter-js-client' library in your plugin's package.json.
  2. Installing Node modules.
  3. 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!


#6

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!


(Purisahil41) #7

Great! :slight_smile:


(system) #8

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.