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.

Required task or step - Chatbot
API integration approach
  1. Authenticate communication

API credentials - token collection via the API.

  1. 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.

  1. Diagnose the user device

NQL API - Retrieve employee device information (e.g., device health, application metrics) to narrow down remediation actions to follow.

  1. Remediate device issues

Remote Action API - Trigger remediation action on target device based on diagnosis, or upon user request.

  1. Follow up and confirm fix

NQL API - Retrieve the results of the remote action execution.

  1. 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.

1

Plan the API integration for a specific chatbot

  1. Verify that your API usage complies with Nexthink's API usage limits. Refer to the Nexthink developer portal documentation for more information.

  2. 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.

2

Set up API credentials in Nexthink

  1. 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

  2. Optionally, configure connector credentials if you plan to use outbound integrations.

3

Create Nexthink content for contextual data retrievals and remediation actions—for API calls

  1. 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.

  2. 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

devices during past 7d
| with session.events past 7d
| where user.name == $username
| list collector.uid, device.name, 
  operating_system.platform, operating_system.name, 
  hardware.type, hardware.manufacturer, last_seen
| sort last_seen desc

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

remote_action.executions past 24h
| where request_id == $request_id
| list request_id, device.name, remote_action.name, 
  status, status_details, outputs

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.

Type
Content

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

devices
| where device.name == $device_name
| include package.installed_packages
| where package.name in ["Microsoft Office", "Microsoft 365"]
| where package.version != "16.*"
| compute outdated_office_packages = package.name.count()
| list collector.uid, device.name,
  remote_action.get_outlook_plugin_crash_details_windows.execution.outputs.CrashedPluginList,
  remote_action.get_outlook_online_windows.execution.outputs.IsOnline,
  remote_action.get_outlook_online_windows.execution.status,
  boot.days_since_last_full_boot, outdated_office_packages

Remediation list

  1. IF remote_action.get_outlook_online_windows.execution.outputs.IsOnline = "No" and remote_action.get_outlook_online_windows.execution.status = "success" THEN Run remediation remote action Set Outlook online

  2. IF remote_action.get_outlook_plugin_crash_details_windows.execution.outputs.CrashedPluginList != "["-"]" THEN Run remediation remote action Set Outlook plugins

  3. IF device.boot.days_since_last_full_boot > 10 THEN Recommend the employee restart their machine.

  4. IF outdated_office_packages = "1" THEN Run remediation remote action Repair Office 365

  5. Additional 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.

Type
Content

Platforms

Microsoft Windows

Data-collection remote action

Schedule data collection remote actions:

  • Get OneDrive status

NQL query

Query ID: #diagnose_onedrive_issues

devices
| where device.name == $device_name
| list collector.uid, device.name,
  remote_action.get_onedrive_status.execution.outputs.OneDriveStatus

Remediation list

  1. IF remote_action.get_onedrive_status.execution.outputs.OneDriveStatus contains one of the following:

    1. OneDrive is not installed

    2. OneDrive is installed but not running

    3. OneDrive environment variable does not exist

    4. OneDrive 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.

Type
Content

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

devices during past 7d 
| where name == $device_name
| include device_performance.events during past 24h
| compute free_space = system_drive_free_space.avg() / 1000000000
| include package.installed_packages
| where package.name in ["*Microsoft Office*", "*Microsoft 365*"]
| where package.version != "16.*"
| compute outdated_office_packages = package.name.count()
| list collector.uid, device.name, free_space,
  boot.days_since_last_full_boot,
  outdated_office_packages,
  remote_action.get_startup_impact_windows.execution.outputs.HighImpactCount,
  remote_action.get_gpo_startup_impact_windows.execution.outputs.UserGpoAppliedTimeInSeconds,
  remote_action.get_gpo_startup_impact_windows.execution.outputs.UserGpoDCDiscoveryInSeconds

Remediation list

  1. IF device.boot.days_since_last_full_boot > 10 THEN Recommend the employee restart their machine.

  2. IF free_space_GB <= 6 THEN Run remediation remote action Disk cleanup

  3. IF remote_action.get_startup_impact_windows.execution.outputs.HighImpactCount > 0 THEN Run remediation remote action Disable Application from Startup menu using the value of remote_action.get_startup_impact_windows.execution.outputs.HighImpactApplications to disable high-impact applications

  4. IF 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 settings

  5. IF outdated_office_packages = "1" THEN Run remediation remote action Repair Office 365


RELATED TOPIC

Last updated

Was this helpful?