OBLYTECH Logo
OBLYTECH Logo

Virtual Agent API Setup: Authentication, Controls and Testing

A working Virtual Agent API integration needs four pieces in order: the application installed on the instance, an inbound endpoint protected by suitable authentication, the controls the chat client renders, and scripted transforms where payload shapes differ. This guide covers each step and the checks that catch common setup failures.

Installing the Virtual Agent API application

The Virtual Agent API is a REST interface built on the conversational custom chat integration framework. It lets a chat window outside the native ServiceNow interface talk to Virtual Agent, and it can run as a secondary bot where a primary bot passes conversations across. Patterns for placing it in a wider architecture are covered in Virtual Agent integration patterns.

Begin with licensing. The application and each of its Store dependencies need valid entitlements, and the API requires a Pro license similar to the one Virtual Agent requires. Before installing, confirm the instance holds valid entitlements for the app and each of its Store dependencies; the install dialog lists any dependencies that install alongside it. The Glide Virtual Agent plugin must also be active.

The installing user needs the admin role or the virtual_agent_admin role. Find the application under All, then System Applications, then All Available Applications, and filter by name or ID. Select a version and choose Install. The Review Installation Details dialog lists dependencies that install alongside it.

Upgrades carry one extra check. When you move from a version earlier than version 2 and authentication is already required, revert the customization first, because the upgrade skips the scripted REST service while authentication is turned on.

Setting up the inbound endpoint and choosing authentication

Open the scripted REST API that receives chat messages. Go to All, then System Web Services, then Scripted Web Services, then Scripted REST APIs, and open the VA Bot Integration record. On its Resources tab, open the BOT Integration resource to see the inbound path the primary bot calls.

On the Security tab, tick Requires authentication. Provider Authentication then offers Basic, OAuth, Hash and Static token. Basic and OAuth work out of the box once Requires authentication is selected, and they allow guest usage, where the person on the other end is not tied to a ServiceNow user.

Account linking changes the choice. Linking a chat user to a ServiceNow account requires token-based authentication, meaning Static or Hash. Token authentication can run alone or alongside Basic or OAuth. The token may travel in the request body or a header. For how the login options compare more broadly, see ServiceNow authentication methods. If it appears in both, the header value is accepted, so check the header first when a token change seems to have no effect.

In practice the options are Basic or OAuth on their own, which allow guest usage but not account linking, and Message Authentication, which uses static or hash tokens, a provider authentication record and a channel identity and is the route that supports account linking. In our reading, Message Authentication suits a caller that is another bot or service able to hold a shared secret.

Configuring Message Authentication for inbound calls

Message Authentication has three parts, built in sequence: a token, a provider authentication record that uses it, and a channel identity that points at that record.

For a static token, go to All, filter for token_verification.list and select New. The form takes a name, a description and a token value, which you can generate yourself or through the Generate Secure Token related link. For a hash token, use the hash_message_verification list instead. Its form takes a name, a description and a secret, which is a random string.

Next, open the message_auth list and create a record with a name and a provider. Point its inbound message verification field at the token you made. The group name and Service Portal fields are optional. The outbound message creation and outbound service token fields are marked as not currently supported in the Virtual Agent API, so leave them alone.

The last step is the channel identity. Open the sys_cs_provider_application list, select the VA Bot to Bot Provider Application record, set the Message auth field in its Provider Channel Identity form to the record you created, and click Update.

For hash tokens, the caller adds an x-b2b-signature header containing an HmacSHA1 digest of the request payload, computed with the token and encoded as hex. The sample signing step hashes a parse-and-stringify round trip of the body rather than the raw bytes the client sent, so if you copy that sample, serialize the body the same way before you compute the digest.

Controls that shape what the chat client displays

Controls are typed message objects the Virtual Agent API sends to the chat client. Output controls carry content to the user, and input controls gather a reply.

Output Text carries a value and a mask type, where NONE means normal text and SECURE marks sensitive output. Output Html carries a markup block and, when Html to image conversion is enabled on the provider record, a rendered image with the links found in the markup. Output Link carries a header, a label, an action address and a target. Multi Link groups several links under one header, and each entry adds a context tag such as KB or ITSM.

Output Card sends a named template and a data string that the client must parse. Four templates are available: Large image with text, Small image with text, a video card, and a record card listing fields from a table row. Multipart output wraps one content control behind a navigation button, and the client must send click_for_more to reach the next part.

Input controls cover what the bot asks. InputText takes a label, a required flag, a mask type and an entity type of text, email or IP address. Boolean offers yes and no. Picker presents a list or a carousel and can attach a card to each option. A StartConversation action message confirms that the conversation has begun.

Transforming requests and responses with scripted extension points

Sometimes the primary bot does not send the shape the API expects, or the reply must come back in a structure the primary bot can read. Scripted extension points handle that without touching the endpoint. The payload transformation point, sn_va_as_service.va_api_payload_transformation, converts the primary bot’s payload before processing. The output transformation point, sn_va_as_service.va_api_output_transformation, converts the API’s response before it returns.

Each point has two functions. shouldTransform decides whether the implementation runs for a given message, and transform returns the changed object. Create an implementation from the Related Links section, write the script and click Update. Keep the condition narrow so unrelated traffic passes through unchanged.

On the request side, the input is an object with payload and headers. The sample maps the primary bot’s user identifier to userId, its email to emailId, its message to message.text with typed set to true, and its language value to a requester session language context variable. It also sets an appInboundId value, custom_1 in the sample.

On the response side, the input holds inputPayload, the original request as the API received it, and responsePayload, the API’s answer. The appInboundId inside inputPayload is how you recognize requests you transformed on the way in. The sample’s shouldTransform returns true when that value matches, and its transform wraps the response in a new structure.

Testing the configuration and reading common errors

Test with an API tool such as Swagger before connecting a live chat client. For a broader acceptance set, see the Virtual Agent testing and acceptance checklist. Send a START_CONVERSATION payload carrying a request identifier, a user identifier, an email address, the action, an empty text message with typed set to true, and an app_name context variable. On a synchronous instance, read the response body. On an asynchronous instance, enable Virtual Agent API logging and check the logs for the outcome.

Structural errors usually trace back to the request body. userId and message.text are the two mandatory fields. requestId is a pass-through value returned in responses. The typed flag is true for search text and false for a value picked from a control. The history array belongs on the first request of a conversation.

File uploads come in two modes. Each attachment needs a content type, a file name and a URL. In synchronous mode, upload the file through the Media API and send the returned media URL. In asynchronous mode, the API fetches a public file URL directly, or a protected one when you supply headers such as an authorization value.

User linking has several moving parts. Automatic linking is the mode available out of the box, and manual linking is not enabled by default. Message authentication must exist, and the request must carry a unique userId and a valid emailId. That email has to match one active user record that is not locked out, and two matches make linking fail. On the VA Bot to Bot Provider record, automatic_link_enabled and link_account_enabled must be true, and the automatic link action must point at the auto-link script. An inactive row for the same userId in the provider user map blocks linking, so an administrator deletes it and retries. A customized auto-link script can also block linking, so test with the out-of-box script to isolate the cause. For the wider access model behind these settings, see Virtual Agent security and access design.

Which app versions and patches should an administrator confirm before adopting Virtual Agent API or AI Agents, and what does the January 2026 Canadian advisory establish?

Before adopting Virtual Agent API or AI Agents, confirm the release, Store app version, dependencies, regional support and security patches for each component. The January 2026 Canadian advisory AV26-022 covers older Now Assist AI Agents and Virtual Agent API versions and urges updates. The advisory is a reason to check versions before adoption, not evidence that any customer was compromised.

What the January 2026 advisory establishes

Canada’s national cyber security agency published advisory AV26-022 on January 13, 2026. It covers older versions of Now Assist AI Agents and Virtual Agent API and urges customers to update. It is a reason to check your own instances, not a finding about any named organization.

The notice is a starting point for planning and does not replace your own inventory of installed component versions.

The checks to record for each instance

Keep a written version record for each instance. Record the following before any workflow is switched on:

  1. The platform release the instance runs, and which of the two components are installed.
  2. The Store app version of each component.
  3. The security patches applied since each installation or last update, compared with the update the advisory urges.
  4. The subscription and entitlement state for each workflow you intend to use.
  5. The hosting region and the processing region the terms allow for each model and skill. A local hosting location on its own does not show that AI processing stays local.

Why skills need their own version check

A platform version check does not cover every skill. Existing Now Assist and Otto skills need the individual skill and its app version validated. Activation also depends on the particular release, Store app version, subscription, region and deployment restrictions, so two instances on the same release can differ in what they are able to switch on.

What to retest after a patch or upgrade

Retest after any change to the model, prompt, knowledge, connector, permission or app. Keep a short test set covering missing knowledge, unexpected instructions and cross-agent handoffs, and run it after each patch, not only at go-live. As a practical starting point, allow read or draft access first and keep a human reviewing consequential steps until the retest passes.

What to request in writing before go-live

  • The exact Store app version of the agent and Virtual Agent API components on your instance, with the dates of the patches applied.
  • The entitlement and subscription terms that govern each workflow, including how usage is counted.
  • A written statement of the processing region for each model and skill in scope.
  • The product-improvement data sharing setting and the opt-out process, including how long an opt-out takes. As of September 10, 2026, an opt-out can take up to five business days to process.

Frequently asked questions

Does the Virtual Agent API need a Pro license?

Yes. It requires a Pro license, similar to the one Virtual Agent requires. Confirm the instance holds valid entitlements for the app and its Store dependencies before installing.

Can I use Basic authentication and still link users to their accounts?

Basic authentication protects the endpoint and supports guest usage, but account linking requires static or hash token authentication. Token authentication can run alongside Basic or OAuth, so the two are not an either-or choice.

Why does a user fail to link to their ServiceNow account?

Start with the email, which must match one active user record that is not locked out, and confirm the request carries a unique userId. Then check the provider user map for an inactive row with that userId, and review the automatic linking settings on the VA Bot to Bot Provider record.

Does a transformation run on each request?

Not necessarily. shouldTransform decides whether the implementation runs, and transform runs when that check returns true. The sample checks a caller value in the payload on the request side and the appInboundId value on the response side.