Nibi for data driven culture

Making data accessible via natural language

Install a widget

Insert below script in the section of page.

(function () {
var script = document.createElement(“script”);
script.type = “text/javascript”;
script.async = true;
script.src = “”; //can be cdn URL
(document.getElementsByTagName(‘head’)[0] || document.getElementsByTagName(‘body’)[0]).appendChild(script);

Configure widget

API_KEY: ”, // API_KEY is same as access token

API_KEY -> This is required property. You can get this property by login in your account and Developer Section(we will have this section in admin account. User can see this in his dashboard)

DATASOURCE_NAME -> This is required property. You can get source name by login in your account and sources list.

Widget is not going to show anything if API_KEY and DATASOURCE_NAME are not entered and valid.

Note – Your widget is ready to use now.

How to use?
Important – There should be existing element in DOM(PAGE) on which autocomplete will be applied

// lets create an instance of autocomplete widget

const widget = new NIBI_AI.autocomplete({
selector: “#INPUT_FIELD_ID”,
placement : ‘TOP|BOTTOM’,
events: {
onInit: () => {
// event is triggered when widget instance is created
onTyping: (npl: string, suggestions: Array) => {
//event is triggered when data is typed and returns whole entered NPL string
// element of array {“full”:”How many companies that”,”suggestion”:”that”,”meta”:{}}
onSearch: (result: any) => {
//event is triggered when question is asked and returns result from API

selector -> pass the ID of input element.
events -> there are three events onInit,onTyping, onSearch

Close Menu