# Twitter client inside kibana plugin (app or vis)

**URL:** <https://discuss.elastic.co/t/twitter-client-inside-kibana-plugin-app-or-vis/83229>\
**Category:** Kibana\
**Created:** [April 21, 2017, 3:17pm UTC](https://discuss.elastic.co/t/twitter-client-inside-kibana-plugin-app-or-vis/83229 "2017-04-21T15:17:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![valereds](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@valereds](https://discuss.elastic.co/u/valereds)\
**Post date:** [April 21, 2017, 3:17pm UTC](https://discuss.elastic.co/t/twitter-client-inside-kibana-plugin-app-or-vis/83229/1 "2017-04-21T15:17:18Z")

</div>

Hi all,  
I'm trying to import this package: [https://www.npmjs.com/package/twitter-node-client](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

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [April 21, 2017, 4:00pm UTC](https://discuss.elastic.co/t/twitter-client-inside-kibana-plugin-app-or-vis/83229/2 "2017-04-21T16:00:46Z")

</div>

@valereds you'll be creating a custom Plugin to do so, please see the following topic for some helpful resources: [Creating custom kibana plugin](https://discuss.elastic.co/t/creating-custom-kibana-plugin/56699)

---

<div class="post-metadata">

**Author:** ![valereds](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@valereds](https://discuss.elastic.co/u/valereds)\
**Post date:** [April 22, 2017, 10:57am UTC](https://discuss.elastic.co/t/twitter-client-inside-kibana-plugin-app-or-vis/83229/3 "2017-04-22T10:57:00Z")

</div>

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:

 ![](https://us1.discourse-cdn.com/elastic/original/3X/6/8/685441808e733566855238a7c7efe023e2208023.png)

---

<div class="post-metadata">

**Author:** ![valereds](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@valereds](https://discuss.elastic.co/u/valereds)\
**Post date:** [April 26, 2017, 7:48am UTC](https://discuss.elastic.co/t/twitter-client-inside-kibana-plugin-app-or-vis/83229/4 "2017-04-26T07:48:17Z")

</div>

Can anybody help me?  
Thanks

---

<div class="post-metadata">

**Author:** ![purisahil41](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@purisahil41](https://discuss.elastic.co/u/purisahil41)\
**Post date:** [May 9, 2017, 3:12pm UTC](https://discuss.elastic.co/t/twitter-client-inside-kibana-plugin-app-or-vis/83229/5 "2017-05-09T15:12:12Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![valereds](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@valereds](https://discuss.elastic.co/u/valereds)\
**Post date:** [May 29, 2017, 1:50pm UTC](https://discuss.elastic.co/t/twitter-client-inside-kibana-plugin-app-or-vis/83229/6 "2017-05-29T13:50:13Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![purisahil41](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@purisahil41](https://discuss.elastic.co/u/purisahil41)\
**Post date:** [May 29, 2017, 2:05pm UTC](https://discuss.elastic.co/t/twitter-client-inside-kibana-plugin-app-or-vis/83229/7 "2017-05-29T14:05:03Z")

</div>

Great! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 26, 2017, 2:05pm UTC](https://discuss.elastic.co/t/twitter-client-inside-kibana-plugin-app-or-vis/83229/8 "2017-06-26T14:05:04Z")

</div>

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