Integrating chatbots using Nexthink REST APIs
Without integration, chatbots cannot retrieve device or user information. This leads to incomplete responses, employee frustration, and unnecessary service desk escalations.
By integrating with Nexthink APIs, your chatbot can:
Provide data-driven chatbot responses
Retrieve real-time device and employee context using NQL queries
Diagnose issues in real time within the conversation
Trigger associated actions to remediate problems instantly
How does chatbot integration work using Nexthink API features?
Nexthink chatbot-API integrations adhere to the following structure:
The chatbot system controls the interaction with employees, including conversation content and logic.
Nexthink provides APIs that the chatbot calls during conversations:
NQL API - Retrieve context-related data from Nexthink.
Remote Action API - If applicable, trigger a remediation remote action.
Optionally, configure Nexthink Outbound connectors export large amounts of data using Data Exporters and Webhooks. Use exported event data to trigger proactive chatbot conversations.

Chatbot flow using Nexthink API technologies
Find below the chatbot flow with tasks to achieve issue resolution via Nexthink APIs.
Authenticate communication
API credentials - token collection via the API.
Identify employee or device
NQL API - Retrieve specific username and/or device identifier data.
(Optional) Data Export- Export essential data, such as user/device names and last seen dates, to regularly enrich the chatbot-integrated CMDB system.
Diagnose the user device
NQL API - Retrieve employee device information (e.g., device health, application metrics) to narrow down remediation actions to follow.
Remediate device issues
Remote Action API - Trigger remediation action on target device based on diagnosis, or upon user request.
Follow up and confirm fix
NQL API - Retrieve the results of the remote action execution.
Proactive identification of issues
Data exporters (optional) - Export all users and devices potentially impacted by the issue to solutions like a data lake. This enables proactive communication of issues to employees.
Webhooks (optional)—Send notifications when specific events or alerts are triggered, allowing chatbots to proactively identify impacted employees.
Configuring Nexthink API features to support chatbot integration
Before implementing API calls within the chatbot's service layer, as a Nexthink administrator, conduct the following preliminary configurations in Nexthink.
Plan the API integration for a specific chatbot
Verify that your API usage complies with Nexthink's API usage limits. Refer to the Nexthink developer portal documentation for more information.
Map how to match users between your chatbot solution and Nexthink.
Nexthink Collector compiles username, SID, and UPN, if activated.
Connector for Microsoft Entra ID provides additional data for mapping, including user email, if activated in your Nexthink instance.
Set up API credentials in Nexthink
Configure API credentials to secure calls from the chatbot to your Nexthink tenant and outbound connections—data exporters and webhooks. Ensure that you have the following permissions activated in your API credentials:
NQL API
Remote Actions API
Optionally, configure connector credentials if you plan to use outbound integrations.

Create Nexthink content for contextual data retrievals and remediation actions—for API calls
Create NQL queries within the Nexthink user interface to define the NQL API calls from the chatbot. Typically, required queries include:
Query to retrieve devices and their basic information for a given user.
Query to retrieve ad-hoc diagnostic information for a given user or device.
Query to retrieve the status and outputs of a remote action.
Create remote actions configured for API triggers. Alternatively, install a large set of preconfigured remote actions from the Nexthink Library that you can use and adapt.

Using pre-built content to implement REST API calls within chatbot's service layer
Once you configured all necessary API features listed above within Nexthink, move on to implementing the REST API calls within the chatbot's service layer—explained in detail in a end-to-end use case.
To help you get started, find below query samples and pre-built content that you can use and adapt when configuring your chatbot orchestration and logic.
You can implement these examples using a chatbot design similar to that depicted in the referenced use case, assuming that you identified the device name beforehand.
Generic NQL query samples for chatbot tasks
As part of configuring chatbot orchestration and logic using REST APIs, you need to set up generic queries to perform two basic tasks below that are useful across all chatbot integrations with Nexthink:
NQL query for retrieving device of a user
Query ID: #get_device_basic_infos - matching based on the username
You can adjust the where clause | where user.name == $username for use with alternative approaches, for example:
If you know the user UPN:
| where user.upn == $upn(requires the UPN to be activated at collector level)If you know the user email address:
| where user.ad.email_address == $email(requires the Azure AD connector to be activated and the email field synced)If you know the device name:
| where device.name == $device_name
Adjust the timeframe if you want to consider devices on which the user has been active during a period of time other than 7 days.
Replace both past 7d clauses with the desired timeframe, up to the maximum data retention period in your Nexthink tenant, which is by default 30 days.
NQL query for retrieving the status and outputs of remediation remote actions
Query ID: #get_remote_action_result
Pre-built content for implementing chatbot REST API calls to address common issues
Use pre-built content—including NQL queries for diagnosis, remote actions and remediation logic—to configure your chatbot integration to diagnose, solve, and confirm the fix status of the following common issues:
Address Microsoft Outlook issues
Diagnose issues that cause Microsoft Outlook to malfunction for an employee.
Platforms
Microsoft Windows
Data-collection remote actions
Schedule data collection remote actions:
Get Microsoft Outlook online
Get Microsoft Outlook plugin crash details
NQL query
Query ID: #diagnose_outlook_issues
Remediation list
IF
remote_action.get_outlook_online_windows.execution.outputs.IsOnline="No"andremote_action.get_outlook_online_windows.execution.status="success"THEN Run remediation remote action Set Outlook onlineIF
remote_action.get_outlook_plugin_crash_details_windows.execution.outputs.CrashedPluginList!="["-"]"THEN Run remediation remote action Set Outlook pluginsIF
device.boot.days_since_last_full_boot>10THEN Recommend the employee restart their machine.IF
outdated_office_packages="1"THEN Run remediation remote action Repair Office 365Additional generic remediation: Run remediation remote action Repair Outlook OST Problem
Address Microsoft OneDrive issues
Diagnose issues related to Microsoft OneDrive and repair OneDrive when the system detects issues.
Platforms
Microsoft Windows
Data-collection remote action
Schedule data collection remote actions:
Get OneDrive status
NQL query
Query ID: #diagnose_onedrive_issues
Remediation list
IF
remote_action.get_onedrive_status.execution.outputs.OneDriveStatuscontains one of the following:OneDrive is not installedOneDrive is installed but not runningOneDrive environment variable does not existOneDrive folder is not present
THEN Run remediation remote action Repair OneDrive
Address slow PC issues
Diagnose a wide range of typical issues resulting in slowness on the endpoint.
Platforms
Microsoft Windows
Data-collection remote actions
Schedule data collection remote actions:
Get GPO startup impact
Get startup impact
NQL query
Query ID: #diagnose_slow_pc_issues
Remediation list
IF
device.boot.days_since_last_full_boot>10THEN Recommend the employee restart their machine.IF
free_space_GB<=6THEN Run remediation remote action Disk cleanupIF
remote_action.get_startup_impact_windows.execution.outputs.HighImpactCount> 0 THEN Run remediation remote action Disable Application from Startup menu using the value ofremote_action.get_startup_impact_windows.execution.outputs.HighImpactApplicationsto disable high-impact applicationsIF
remote_action.get_gpo_startup_impact_windows.execution.outputs.UserGpoAppliedTimeInSeconds+remote_action.get_gpo_startup_impact_windows.execution.outputs.UserGpoDCDiscoveryInSeconds> 10 THEN Run remediation remote action Update Group Policy settingsIF
outdated_office_packages="1"THEN Run remediation remote action Repair Office 365
All remote actions listed above should be installed from the Nexthink Library and require prior configuration:
Data-collection remote actions must have an active Schedule-type trigger and a collection schedule set to hourly or daily, depending on the required frequency.
Remediation remote actions must have an active API-type trigger.
RELATED TOPIC
Last updated
Was this helpful?