Authentication
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.
Overview
The authentication required for a third-party chatbot to integrate with Chatbot SDK is based on an API Key.
Usage of the API key
You can use a unique, valid API Key at any time.
The chatbot will need to use the key as an authentication method by adding an HTTP extended header
X-API-key:
in every REST API call.
Generation of the API Key
Internally, the API key is generated based on the Nexthink user and password configured in the .env file. Therefore, it is recommended to integrate the chatbot with a dedicated Nexthink user and password just for Chatbot SDK.
Every time the Nexthink password or user is changed in the .env file, the key needs to be regenerated and updated in the chatbot. This can be done programmatically.
Nexthink operator generates the API Key using the same user and password configured in the .env file with the following command:
$ curl -X POST -k https://:@localhost:8090/v1/api_key
where <Nexthink_user>
is the local user from Nexthink Portal added during the installation and available in the /var/nexthink/nexthink-chatbot-adapter/.env
file.
If the password <Nexthink_pass>
has special characters, they need to be escaped or encoded using base64 and sent in a basic authentication header.
Here is an example of how you can encode the username and password using base64 directly in the system terminal to be later used on the curl command:
$ echo 'username:Secret!10' | base64
dXNlcm5hbWU6U2VjcmV0ITEwCg==
$ curl -X POST -k https://localhost:8090/v1/api_key -H 'Authorization: Basic dXNlcm5hbWU6U2VjcmV0ITEwCg=='
Remember that the header content starts with Authorization: Basic
This generated API key must be shared with the chatbot integrator.
Please note that the returned key ends with a new line character. This is done for readability purposes and must not be included with the key itself. In the case of automatic integration, the returned result must be cleaned up.
Retrieval of the API Key
If you need to retrieve the API key, for instance, to share it with Nexthink Support for debugging purposes, use the following command:
$ curl -k https://:@localhost:8090/v1/api_key
Please note that the returned key ends with a new line character. This is done for readability purposes and must not be included with the key itself. For automatic integration, the returned result must be cleaned up.
Last updated