Skip to main content

We Built a Self-Service Help Desk Inside Teams Using the OpenAI API

Nick Ross3 min read

TL;DR

  • As of December 2022, the OpenAI completions API can power a working self-service support hub inside a custom Microsoft Teams app.
  • The microsoft/teams-js library exposes the signed-in user's profile, which lets the app match the user to a PSA contact and surface their open tickets.
  • Temperature is a real tradeoff: a setting of 0.06 produced consistent but sometimes shallow answers, while 1 produced more accurate answers alongside occasional wild ones.
  • Responses get truncated when maxTokens is too low, but raising it raises cost: the Davinci model billed 2 cents per 1,000 tokens as of December 2022.
  • The PSA pattern works with any ticketing platform that exposes an API, including Syncro, ConnectWise, AT, and BMS.

A large share of help desk tickets are questions, not problems. That is exactly the shape of work ChatGPT looks built for, and in December 2022 the buzz around OpenAI's new model is hard to ignore. The underlying technology already proves itself daily in tools like GitHub Copilot, where it speeds up both development and learning. So we ran a proof of concept aimed at the MSP support desk: a custom Microsoft Teams app that acts as a support hub, answering user questions through the OpenAI API for text completion, while also integrating with our PSA tool to show users their open tickets and let them create new ones. Here is how the build came together.

A short demo recording of the app in action: watch the POC walkthrough (opens in new tab).

What the proof of concept does

The build, in five moves:

  • Acquire an OpenAI API key
  • Build a custom Teams app from a Microsoft sample using React and JavaScript
  • Call the OpenAI API whenever a user asks a question
  • Use a React library to grab the user's profile info from Teams, then look them up in the PSA tool to pull all of their active tickets
  • Reuse that same profile to tie the user to a ticket when they submit a new case

How the OpenAI completions call works

The OpenAI API documentation (opens in new tab) covers the available endpoints. This build uses the completions API, making a POST request when a user submits a question.

OpenAI completions API request showing model, prompt, temperature, and max token parameters

The request body defines the model, the prompt (whatever the user types in), the temperature, and the max tokens. The QuickStart tutorial section of the docs includes a sample worth working through; it makes clear what the API is doing under the hood before you wire it into anything.

Standing up the custom Teams app

Microsoft provides sample tutorial apps and a getting-started path here: Get started - Teams | Microsoft Learn (opens in new tab). The JavaScript and React sample is the one to start from if you want to replicate this build.

Tying tickets to the signed-in user

The PSA integration is plain API work. This POC used Syncro because that was the ticketing system already in place, but the pattern replicates across any platform with an API: ConnectWise, AT, BMS, and the rest. The microsoft/teams-js library pulls in the profile of the currently signed-in Teams user. From there, the user's UPN looks up their contact ID in the PSA tool, a follow-up call fetches all of their open tickets, and the same identity gets attached when they submit a new ticket.

What temperature and tokens actually cost you

Two parameters shaped the results more than anything else.

Temperature controls how much risk the model takes when deriving an answer. At 0.06, answers came back consistent but not always as accurate as we wanted. At 1, answers were sometimes more accurate, and sometimes genuinely wild. There is no free lunch here; pick the failure mode you can live with.

maxTokens caps the response size. Tokens correspond to the amount of words submitted in a prompt: more words, more tokens. Set the cap too low and responses come back truncated. So why not just crank it to the maximum? Because tokens are the pricing unit:

OpenAI pricing table showing per-token costs by model as of December 2022

This build uses the Davinci model at 2 cents per 1,000 tokens, as of December 2022. That sounds like nothing until you do the math on users blowing up the chat all day. Cost becomes a first-order design concern, not an afterthought.

Where to take it

There are plenty of places this technology could earn its keep inside an MSP, and self-help support is just the first obvious one. The full code for the app is public: msp4msps/OpenAI_MSTeams on GitHub (opens in new tab). Clone it, point it at your PSA, and see what your users do with it.

Frequently asked questions

Why not just set maxTokens to the highest possible value?

Tokens are the pricing unit. The Davinci model cost 2 cents per 1,000 tokens as of December 2022, which sounds small until users start hammering the chat all day. Cost climbs quickly with both prompt length and response length.

Does this approach require a specific PSA tool?

No. The proof of concept used Syncro because that was the ticketing system already in place, but the same pattern, looking up a contact by UPN and reading or creating tickets, replicates across any PSA with an API: ConnectWise, AT, BMS, and others.

Know what every AI experiment can touch

Every OpenAI integration is an app consent living in someone's tenant. CloudCapsule flags risky consents and checks 250+ controls across every tenant you manage in about 60 seconds.

Run a free scan
Nick Ross

Written by

Nick Ross

CEO · Microsoft MVP · Founder, T-Minus 365

Nick is not just a CEO, he's a respected thought leader and influencer in the MSP space. Tens of thousands of MSPs learn through his YouTube channel, T-Minus365. Nick has been honored as a three-time Microsoft MVP for his educational content; his expertise and influence are the backbone of our mission, ensuring that you are in the best hands when it comes to security.

Nick joined Pax8 in 2017, where he would ultimately oversee product management for PSA and Microsoft integrations. Following his tenure at Pax8, Nick has continued to demonstrate his leadership prowess as an executive at various MSPs, culminating in his most recent role at Sourcepass.

Nick holds a Bachelor's Degree in Business Management from Florida State University, as well as a Minor Degree in Entrepreneurship. In his free time, Nick is an avid hiker, reader, and fitness-junkie.

Keep reading