PowerShell module that utilises the Freshservice API

I posted this in the Community forum, and @Zach suggested I post it here too…

I’ve started work on a PowerShell module to utilise the Freshservice API to manage tickets. I intend to add more functionality when I can, but at the moment it will work with the APIs concerned with tickets, conversations, requesters, agents, groups, service catalog items, custom objects, locations and departments.

If you’d like to take a look, it’s available on GIthub here: GitHub - LesNewbigging/FreshAPIv2: A PowerShell module containing functions that invoke the Fresh v2 APIs

Feel free to use it and adapt it to your own requirements.

Comments and suggestions are welcome.

5 Likes

Hey Les. I am working on a Powershell Module for Freshservice as well but haven’t posted yet. We could probably combine forces to put together a well tested module. Here are the functions developed:

Add-FreshServiceRequesterGroupMember
Get-FreshServiceAgent
Get-FreshServiceAgentGroup
Get-FreshServiceAgentRole
Get-FreshServiceAsset
Get-FreshServiceAssetRelationshipType
Get-FreshServiceAssetType
Get-FreshServiceBusinessHour
Get-FreshServiceCatalogCategory
Get-FreshServiceCatalogItem
Get-FreshServiceContract
Get-FreshServiceDepartment
Get-FreshServiceForm
Get-FreshServiceLocation
Get-FreshServiceOnboardingRequest
Get-FreshServiceProduct
Get-FreshServiceProject
Get-FreshServicePurchaseOrder
Get-FreshServiceRequester
Get-FreshServiceRequesterGroup
Get-FreshServiceRequesterGroupMember
Get-FreshServiceSoftware
Get-FreshServiceSoftwareUser
Get-FreshServiceTask
Get-FreshServiceTicket
Get-FreshServiceTicketConversation
Get-FreshServiceVendor
New-FreshServiceAgent
New-FreshServiceAgentGroup
New-FreshServiceAgentRoleConfig
New-FreshServiceAsset
New-FreshServiceAssetType
New-FreshServiceContract
New-FreshServiceDepartment
New-FreshServiceLocation
New-FreshServiceProduct
New-FreshServiceProject
New-FreshServicePurchaseOrder
New-FreshServiceRequesterGroup
New-FreshServiceRequestor
New-FreshServiceSoftware
New-FreshServiceSoftwareUser
New-FreshServiceTask
New-FreshServiceTicket
New-FreshServiceTicketNote
New-FreshServiceVendor
Remove-FreshServiceAgentGroup
Remove-FreshServiceAsset
Remove-FreshServiceAssetType
Remove-FreshServiceDepartment
Remove-FreshServiceLocation
Remove-FreshServiceProduct
Remove-FreshServiceProject
Remove-FreshServicePurchaseOrder
Remove-FreshServiceRequester
Remove-FreshServiceRequesterGroupMember
Remove-FreshServiceSoftware
Remove-FreshServiceSoftwareUser
Remove-FreshServiceTicket
Remove-FreshServiceVendor
Restore-FreshServiceAsset
Set-FreshServiceAgentGroup
Set-FreshServiceAsset
Set-FreshServiceAssetType
Set-FreshServiceConnectionSettings
Set-FreshServiceContract
Set-FreshServiceDepartment
Set-FreshServiceLocation
Set-FreshServiceProduct
Set-FreshServiceProject
Set-FreshServicePurchaseOrder
Set-FreshServiceRequesterGroup
Set-FreshServiceRequestor
Set-FreshServiceSoftware
Set-FreshServiceSoftwareUser
Set-FreshServiceTicket
Set-FreshServiceTicketTask
Set-FreshServiceVendor

Let me know if you would like to collaborate and would like to publish to Powershell Gallery for Community consumption.

2 Likes

Hello Rob

That sounds great!

I concentraed on getting it working with tickets first, adding in requesters, agents, groups, service catalog items and custom objects - but I see you’ve also covered areas I haven’t got to yet!

If you look at mine on Github, I’ve broken down the various modules into their own nested modules:

  • FreshAPI.CustomObjects.psm1
  • FreshAPI.Departments.psm1
  • FreshAPI.Locations.psm1
  • FreshAPI.Requesters.psm1
  • FreshAPI.ServiceCatalog.psm1
  • FreshAPI.Tickets.psm1

These mainly follow Fresh’s API documentation, though the requesters module also includes agents, roles and groups, whilst tickets also includes conversations.

The FreshAPIv2.psm1 module contains functions that make the GET/POST/PUT/DELETE calls to the API, with some error handling (e.g. waiting before resubmitting a 429 request), along with some other supporting functions.

Take a look and let me know what your thoughts are.

Les

I am really liking this Module. We use it to update User objects in Freshservice to match users to their location. When will you get a chance to add the Asset management. I could really use that feature to manage assets. looking forward to see more modules.

Thanks Perry

I’m glad you’re finding it useful!

If I remember righthly, assets also involves products, and therefore vendors, and a few other bits. We’re you looking for software, contracts and purchase orders too?

I’m not sure when I can get them done, but intend to spend some time on it soon.

L

Thanks for the reply,

I am just looking at managing assets at the moment.
That’s the immediate need so i can build a lifecycle for assets.

Still chipping away at my module and hope to have it ready for release shortly and will update this thread. With Workspaces coming out, there will be changes to the APIs as well, so waiting for the documentation to be updated.

I’m enjoying the PowerShell module, great work. I looking to use it to automate more of our processes.

Successfully used the modules provided by @LNew , however I was hoping for functions to manage Assets as I would like to automate our devices lifecycle. The Freshservice Module in PowerShell Gallery https://www.powershellgallery.com/packages/FreshService.Tools/1.0.1 looks to have more functions, including managing assets.

So far I have been unable to get the FreshService.Tools Module to work. It complains

“parameter cannot be found that matches parameter name ‘FollowRelLink’”
Which is a PowerShell 7 Parameter. (As far as I understand)

Are both the FreshAPI and the FreshService.Tools modules being developed or are they now merged?

@perry_mahlmann , did you build a lifecycle for assets with these modules? How did it go ?

Hello Andrew
Firstly, I’ve only just come across FreshService.Tools, so don’t know anyhthing about it.

Regarding asset management, I’d intended to start on it, but hadn’t got to it just yet, Hopefully I can get something committed to GitHub soon.

L

1 Like

Hey All,

Appreciate any patience if anyone has been wondering about development efforts. Been a lot of work, but I’ve gotten almost every API endpoint in a Powershell Module. While PS 5.1 will work, highly recommend using VSCode + 7.x as you get errors from API validation and it supports attachments.

PowerShell Gallery | FreshservicePS 0.1.0

flycastpartnersinc/FreshservicePS: Powershell Module to interface with Freshworks Freshservice REST API. (github.com)

Have reported some bugs to Freshworks development and will put those in Github as I retest and confirm, but it’s only a handful of items. If you can assist with testing, provide feedback, would really appreciate any assistance. Also setup a Slack channel for discussions (invite on Github readme\docs).

1 Like