Earl Duque
Administrator
Administrator

 

 Building a Custom Sleep Tracking App with ServiceNow’s Now Assist Skill Kit

 

In the fast-evolving landscape of ServiceNow, the Now Assist Skill Kit opens up new possibilities for developers. This generative AI toolkit enables developers to create skills that leverage ServiceNow’s proprietary AI models, allowing direct integration into apps with tailored prompts. In this Live Coding Happy Hour session, our developer advocates Earl, Laura, and Kristy demonstrated how to use the Skill Kit to build a custom sleep tracking app.

 

Starting Off with Now Assist Skill Kit

 

We kicked off the session with a quick overview of Now Assist Skill Kit and its purpose within the ServiceNow ecosystem. This tool allows developers to create custom AI-driven skills that can be embedded within ServiceNow applications. In Earl’s words, “One of the coolest things about Skill Kit is that we can build prompts and get responses from ServiceNow’s own model, which understands ServiceNow’s APIs, docs, and platform nuances.”

 

Setting Up the Sleep Tracking App

 

To start building the app, we created a custom table to store sleep records. We defined fields for tracking hours slept, date, and a field to display the AI’s analysis. Each record would store the amount of sleep entered by the user and, once processed, would receive a “sleep quality analysis” from the AI model.

 

Building and Testing Our First Skill

 

Using the Skill Kit interface, we created a skill called “Sleep Analysis.” The goal of this skill was to take the number of hours slept as input and provide an analysis based on sleep recommendations. We structured the prompt to be as specific as possible, following a “RISEN” methodology:

 

  • Role: Establish the Al's role, setting the stage for the type of response expected.

  • Instructions: Clarify what you want the Al to do, providing a clear directive.

  • Steps: Break down the task into manageable steps, ensuring a logical progression.

  • End Goal: Define the ultimate objective of the prompt, guiding the Al's focus.

  • Narrowing: Set any constraints or limitations to tailor the response to your specific needs.

After some initial testing, the AI responded with accurate, simple feedback based on hours slept, indicating if the sleep duration was within a healthy range.

 

Adding Automation with Business Rules and UI Actions

 

To streamline the app, we wanted the sleep analysis to run automatically upon record creation. Initially, we explored setting this up through a UI action, where users would click a button to get their sleep quality analysis. However, for a more seamless experience, we shifted our focus to using business rules.

 

By setting up an asynchronous business rule, we ensured that each new sleep record triggered the Skill Kit’s analysis without manual intervention. This automation helped in making the sleep analysis process both smooth and user-friendly.

 

Challenges and Workarounds

 

As with any live coding session, challenges emerged. One of the biggest was working with Skill Kit’s output and handling async operations within a business rule. Additionally, we ran into some quirks with logging and data persistence, leading to creative workarounds.

 

A highlight of this session was our exploration of Now Assist Skill Kit’s “pre-processors” and “post-processors.” These tools allow developers to modify inputs and outputs, but figuring out exactly how to utilize them with our custom fields required some trial and error.

 

What’s Next?

 

While we were able to get a basic version of our sleep tracking app working, there’s still plenty of room for iteration. Next steps might include:

  • Adding historical trend analysis by using Skill Kit’s data tools.
  • Exploring more complex workflows in Flow Designer for even smoother automation.
  • Leveraging ServiceNow’s data visualization capabilities to create user-friendly reports on sleep patterns.

 

Final Thoughts

 

This session was a perfect example of Live Coding Happy Hour at its best: tackling new tech, experimenting with ServiceNow’s capabilities, and solving problems on the fly. Now Assist Skill Kit holds a lot of promise for ServiceNow developers looking to incorporate AI into their applications, and our sleep tracking app is just one of many possibilities.

 

If you’re a ServiceNow developer or just curious about AI integration, try out Now Assist Skill Kit and let us know what you build!

1 Comment