This document provides comprehensive information about the introduction and concepts around Nexthink Chatbot SDK, its API and use cases. The information contained herein is subject to change without notice and is not guaranteed to be error-free. If you find any errors, please report them to us via Nexthink Support Portal. This document is intended for readers with a detailed understanding of Nexthink technology.
This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.
Changing global variables
Global variables can be changed manually by editing the
$ vi /var/nexthink/nexthink-chatbot-adapter/.env
Chatbot SDK cache refresh frequency. The default value is 1h. Valid time units are
Requests per second limit for the cache database, Portal and each of the Engines. If this limit is surpassed, Chatbot SDK will return error 429. These variables are set to prevent an overload of the backend services. Default values are 500, 20 and 40.
Chatbot SDK logging level. The default value is 4 (Info). Valid values are:
This variable controls the timeout for NXQL queries and the default value doesn’t have to be changed. Please refer to the Troubleshooting guide for more information.
This is the password for the existing PostgreSQL DB that serves as a cache for Chatbot SDK. The password is randomly generated during the installation process but can be modified if needed.
Note that the PostgreSQL database used as cache is automatically managed by Chatbot SDK, and therefore there is no need to modify it.
If the password is manually modified in the file, the following additional steps will be required to update the user credentials in PostgreSQL DB. Until the containers are reloaded, service errors may occur.
$ cd /var/nexthink/nexthink-chatbot-adapter $ docker-compose exec postgresql psql -c "ALTER USER postgres WITH PASSWORD '<NEW_PASSWORD>';" -U postgres -w
USER_ACTIVITY_PERIOD: Time in days used to filter devices populated in the local cache that were present during the defined period in the Engines. In order for the manual changes to take effect, the Docker containers must be reloaded.
$ cd /var/nexthink/nexthink-chatbot-adapter $ docker-compose up -d
Modifying the list of Engines
Engines are populated during the installation and can be updated. If you need to modify the list of Engines manually, you must change this file:
$ vi /var/nexthink/nexthink-chatbot-adapter/config/engines.yaml --- engine_1: host: 192.168.5.5 port: 1671 databaseUID: XXX timezone: Europe/Madrid engine_2: host: 192.168.5.5 port: 1672 databaseUID: XXX timezone: Europe/Madrid
You can find the
databaseUID value by accessing the Portal API through the following endpoint:
$ curl -k https://<Nexthink_User>:<Nexthink_Pass>@<Nexthink_Portal_Host>/api/configuration/v1/engines
Engines must have a unique name.
In order to apply these manual changes, the Docker containers must be restarted.
This creates a new discovery process to refresh the local cache.
Increasing the log level
Logs are written in the standard output for each Docker container. You can read all of them as follows:
$ cd /var/nexthink/nexthink-chatbot-adapter $ docker-compose logs
The log level is set in the Chatbot SDK .env file with a variable
$ vi /var/nexthink/nexthink-chatbot-adapter/.env
To get the new log level, you must save the .env file with the new value and restart the Docker containers:
Nexthink local user configuration in Portal
It is recommended to create a specific Nexthink local account in Portal for Chatbot SDK. The user needs an authentication profile for remote actions API which can be set up in the Administration portal. The following scenario demonstrates how to setup up an admin_user profile:
Log in to the Portal as an admin.
Select the admin tab and then Profiles.
Create or edit an existing user profile.
Select none (full access) for Data Privacy in step 2.
Check Allow API of remote actions.
Modifying the discovery user_activity query
In some deployments, the user activity on a device is not reported on a regular basis. This may be related to General Data Protection Regulation (GDPR) compliance where the user activity feed is disabled. Also, it may be related to infrequent logins by the user.
In case the user activity is not being reported to Engine by Collector, Chatbot SDK will not include those devices in its cache. Since Chatbot SDK serves information relevant to the devices included in the cache, this can lead to the chatbot’s inability to interact with devices that are not a part of it.
By default, user activity is retrieved from
user_activity table. You can change it, however, to
execution table instead as described below:
The user activity query is defined in the configuration file
Any changes to the configuration file should be performed by a Nexthink specialist.
# To be modified only by Nexthink Professional Services # NXQL Query filtering by user_activity query: (select ((device (device_uid)) (user (sid distinguished_name name)) (user_activity (time))) (from (user device user_activity) (where user (ne type (enum system)) ) (between now-<USER_ACTIVITY_PERIOD> now) ) (limit 4294967295) )
# NXQL Query filtering by execution # query: (select ((device (device_uid)) (user (sid distinguished_name name)) (execution (start_time))) # edit start # (from (user device execution) # (where user # (ne type (enum system)) # ) # (where binary # (eq executable_name (pattern *explorer.exe*)) # ) # (where execution # (gt start_time (datetime now-<USER_ACTIVITY_PERIOD>)) # (lt start_time (datetime now)) # ) # (between now-<USER_ACTIVITY_PERIOD> now) # ) # (limit 4294967295)) # edit end
Comment in one query and comment out the other one. After the next restart of the services, the discovery will start using the uncommented query.
If you need to customize the query, only change the filter part between the code marked as
#edit end, leaving the fields selection as is.