Integrating Freshservice with Lansweeper Cloud Site— IT Asset Management— Custom App

Sachin Kumar
3 min readMay 21, 2022

Overview

Freshservice is a cloud-based internal IT helpdesk and service management platform that helps organizations to simplify and automate their internal IT operations. It provides ITIL-ready components that help administrators manage assets, incidents, problems, change and releases.

IT Asset Management (ITAM) is “a set of business practices that incorporates IT assets across the business units within the organization.

The Integration

Lansweeper is an IT Asset Management solution that gathers hardware and software information of computers and other devices on a computer network for management and compliance and audit purposes. Lansweeper Cloud federates data from all local Lansweeper discovery instances into a single source of truth.

Pre-requisites

  • A Lansweeper Cloud Site connected with Lansweeper on premise installation.
  • A Freshservice Instance with API access.

The Application

The custom application allows users to perform following activities;

  • Ability to connect to authorized Lansweeper Cloud Sites
  • Ability to retrieve the asset types and assets discovered using Lansweeper
  • Ability to sync assets from Lansweeper site to Freshservice
  • Ability to listen and act on changes made to an asset in Lansweeper console.

Application Flow

High level Application Flow

Key Components

Full Page App

Full page apps allow developers to build applications using Freshworks SDK which are rendered on full screen. As shown in the video the custom app build for this integration is a full page app which allows admins to sync assets from a Lansweeper site to Freshservice.

Lansweeper Cloud APIs

API Endpoint:

https://api.lansweeper.com/api/v2/graphql

For more details, please refer Lansweeper API documentation for API specifications and uses. Application uses following APIs to retrieve asset and related details from Lansweeper.

  • Getting authorized Lansweeper Sites
{query”: “{ me { username profiles { site { id name } } }}”}
  • Getting Lansweeper Asset Types for the Site
{"query": `{ site(id: \"${site_id}\"){        id        assetTypes        }}`}
  • Getting All Assets from Lansweeper Site (Example Query)
{"query": `{ site(id: \"${ls_site_id}\"){ assetResources(assetPagination: { limit: 100, page: FIRST },fields: [\"key\",\"assetBasicInfo.name\",\"assetBasicInfo.domain\",\"assetBasicInfo.mac\",\"assetBasicInfo.type\",\"assetBasicInfo.ipAddress\",\"assetBasicInfo.fqdn\",\"assetCustom.serialNumber\",\"assetCustom.location\",\"assetCustom.model\",\"assetCustom.warrantyDate\",\"assetCustom.purchaseDate\",\"assetCustom.manufacturer\",\"assetCustom.sku\",\"operatingSystem.caption\"],filters: { conjunction: AND, conditions: [{ operator: NOT_EQUAL, path: \"assetBasicInfo.type\", value: \"Location\" }] }  ){ total pagination { limit current next page } items } } }`}
  • Getting All Software for an Asset from Lansweeper (Example Query)
"query": `{\r\n  site(id: \"${ls_site_id}\") {\r\nsoftwares(key: \"${assetKey}\"\r\norderDirection: DESC\r\norderBy: \"softwares.release\"\r\nfields: [\"softwares.installDate\",\r\n\"softwares.lastChanged\",\r\n\"softwares.currentUser\",\r\n\"softwares.msi\",\r\n\"softwares.name\",\r\n\"softwares.publisher\",\r\n\"softwares.operatingSystem\",\r\n\"softwares.version\",\r\n\"softwares.release\",\r\n\"softwares.architecture\",\r\n\"softwares.status\",\r\n\"softwares.error\",]){\r\n      total\r\n      items\r\n    }\r\n  }\r\n}`}

Freshservice APIs

For more details, please refer Freshservice API documentation for API specifications and uses. Application uses following APIs to map and manage assets from Lansweeper site to Freshservice.

  • List all asset types : With the help of this API, we can fetch all the asset types from Freshservice which allows admins to map and store asset type mappings between both the systems.
  • List all asset type fields : With the help of this API, we can fetch all the asset fields from Freshservice asset type which allows admins to map one to one mapping from Lansweeper asset type fields.
  • Create Asset, Update Asset, View Asset and Filter Assets : Based on incoming asset details from Lansweeper, these APIs allows to manage Assets in Freshservice.
  • Freshservice Software APIs : Allows to perform CRUD operations on software related to an asset which are synced from Lansweeper site.

Key-Value Storage

Application uses the Freshworks platforms Key-Value Storage to store mapping between the Freshservice asset and corresponding Lansweeper assets.

client.db.set(ls_asset._id, {"fs_asset_id": fs_asset_id,"softwares": softwares})

This allows us to avoid the duplication of assets while syncing the assets.

Freshservice External Events

Application uses external event to register Webhooks in Lansweeper site to listen and updates assets in Freshservice based configured events.

Example Webhooks configuration

{"query": "mutation {\r\n  appAccount{\r\n    addWebhook(webhookParams: {\r\n      name: \"Sachin fs external webhook\",\r\n      description: \"Sachin fs external webhook\",\r\n      payloadUrl: \"https://<<freshservice webhook url>>\",\r\n      resourcesFields: [\"antiviruses\",\"assetBasicInfo\",\"computerSystems\",\"assetCustom\"],\r\n      enabled: true,\r\n      eventsSubscribed: [\"INSERT\",\"DELETE_SITE\",\"DELETE\",\"UNLINK\"],\r\n      version: 2\r\n    }) {\r\n      description\r\n      name\r\n    }\r\n  }\r\n}"}

That’s all for now. Please feel free to leave a comment if you liked the article and/or would like to explore more about this integration. Happy reading!!!

--

--