OBLYTECH Logo
OBLYTECH Logo

Virtual Agent Chat Widget Embedding and Greeting Setup

To put Virtual Agent on a page outside your ServiceNow instance, add the portable chat widget to that page, confirm the page’s domain can reach your instance, and set the greeting through system properties. Enhanced chat and standard chat each use their own script. The older iframe method still exists for standard chat.

Check the domain and access rules first

The widget loads inside an inline frame, so the hosting page has to sit in the right place relative to your instance. When the site shares a parent domain with the instance, setup is straightforward. A site on a different domain needs a custom instance URL, and without one browser security may stop the widget loading. Activate the Custom URL plugin (com.snc.customurl) as an admin, then add your purchased and registered custom URL to the instance.

ServiceNow supports the portable widget when the top-level domain and domain name both match the loading site. Anything beyond that line needs a custom solution of your own. Read the Virtual Agent overview before choosing a route.

Who can see the chat

Enhanced chat starts from an assistant linked to a portal in Conversational Interfaces > Assistant Designer. The linked portal can be a placeholder, but its suffix is required in the script.

Setup needs the admin role, or the virtual_agent_admin role for the greeting steps.

Add the widget to your page

Enhanced chat script

Enhanced chat starts from an assistant linked to a portal in Conversational Interfaces. The linked portal can be a placeholder, but its portal suffix is required in the script. In the page header, import the EnhancedChat module from the externals path on your instance using a module script. Then create an EnhancedChat object with two values: the instance origin and the portal suffix. Common suffixes are esc and sp, or the suffix of a custom portal.

If your organisation uses a custom domain, enter that domain as the instance value rather than the default ServiceNow address.

Standard chat script

Standard chat uses the ServiceNowChat popover app, created with the instance origin. Context, branding, offsets and translations go in the same object, and position accepts left or right.

The legacy iframe method

The older method loads the widget in an iframe that points to the embed page on your custom URL. For new pages, use the portable widget. The legacy method covers standard chat only. If you keep the iframe, add the skip-history parameter set to true to load without the previous conversation.

Plan for Safari. Apple blocks cross-origin frames, so the widget does not run in an iframe there by default.

Set the frame security properties and CORS rules

Two system properties decide which pages may frame the widget. The first, com.glide.cs.embed.csp_frame_ancestors, sets the frame-ancestors directive in the Content-Security-Policy header. Its default is ‘self’, and it accepts host sources (including a wildcard subdomain pattern), scheme sources such as https, or none.

The second, com.glide.cs.embed.xframe_options, sets X-Frame-Options. Its default is sameorigin, and deny blocks framing entirely. The allow-from value no longer works in modern browsers, so do not build a plan around it. This property matters mainly for Internet Explorer 11.

Cross-origin calls need a CORS rule. Go to All > System Web Services > REST > CORS Rules, select New, pick the REST API the widget calls, and enter the website’s domain as the Domain value. The Domain field does not accept wildcards, so each subdomain needs its own rule. The max age field sets how many seconds the browser remembers a preflight check. Select the GET method, because the widget receives data from the instance and does not send data back.

Set the widget’s size, position and branding

Review these layout defaults before the widget goes live.

Option Default What it controls
position Floating panel (undefined) Starting state: modal or pinned
pinnable true Shows the pin button that docks the panel full height
expandable true Shows the expand button that turns the panel into a centred modal
offsetX and offsetY 25 pixels Distance from the right and bottom edges
zIndex and modalZIndex 1000 and 4000 Stacking order when floating and in modal mode
title Now Assist Header text and the frame’s accessible title

The enhanced launcher stays at the bottom right, with no setting to move it.

Colours accept any valid CSS colour value. Branding settings are grouped by the part they paint: the launcher, the panel and the header. The launcher takes background, hover, active and icon colours plus a custom open icon. The panel takes a full CSS border and box-shadow value. Icon-only button labels are configurable too. The defaults are Open chat, Close chat, Pin, Unpin, Expand and Contract.

Set the greeting text

The Greeting setup topic shows two lines when a conversation starts: a welcome message, and a prompt that sits above the topic list. Change them with two string system properties, com.glide.cs.general.welcome_message and com.glide.cs.general.top_selection_message. Create each in the system properties table, set the type to string, and enter the text.

Since the Orlando release these two properties are not installed by default, and the updated Greeting topic is the standard. Instances upgraded from the New York release keep the original properties, which override the newer topic. Delete both properties to switch over.

To change more than the wording, create a custom setup topic and assign it to the chat experience, as is done for closing messages. Default setup topics are read-only and their names end in a full stop, such as Greeting. The pre-built Dynamic Greeting topic addresses the visitor by name. To make it the default, double-click the Setup topic name and pick it from the list.

Setup topics appear in the topic picker when they belong to a chat experience that uses the Custom Greetings and Setup option. Leave one out and it disappears from the All Topics menu and cannot be discovered by the assistant.

How the conversation moves between setup topics

Setup topics run at points that depend on what the visitor does.

Moment in the conversation Setup topic that runs What the visitor sees
Conversation opens Greeting Welcome line, a prompt, and the promoted topics
Visitor asks for help Explore help A list of things the assistant can do
Input is not understood Fallback, or AI Search results first A standard message, or search results if AI Search fallback is enabled
Unrecoverable system error Error Handling A generic error, then a transfer to a live agent
Visitor asks for a person Live Agent A transfer is in progress
Task completed Anything else A question about further help
Visitor is finished Survey, then Closing A feedback choice list, then a closing message

If you want visitors to reach a person straight away, do not select Live Agent Support as the greeting. Use the system transfer method instead. The survey appears in 33 percent of conversations by default. To change that share, set com.glide.cs.survey.probability; a value of 0.50 gives half.

Sign-in and single sign-on for visitors

Single sign-on is optional. It needs an external SSO provider on your instance, with the same provider on the hosting site. For the enhanced portable script, set manageNowLogin to true to have the host page redirect to SSO login. For the legacy iframe method, add the SSO script described in the embed topic. The script watches for a guest session being created or a session being logged out, then sends the visitor to the login page with a redirect back to the originating page. Each redirect target must be listed in com.glide.cs.web_client_login_redirect_urls, as a full address or a host part.

System messages

The web widget reads its greeting and closing text from the Messages table. Third-party integrations such as Microsoft Teams read system messages instead, which you edit under Conversational Interfaces, Settings, System messages.

Asynchronous messaging on the web channel

The web channel record, mweb, is a chat channel by default. The web channel can run in messaging mode, which is also called Asynchronous Chat. Set this on the mweb record in the Messaging Channel table (sys_cs_channel) by changing its Type field to Messaging. In that mode, a conversation closes as Closed Abandoned when the user does not respond to an agent message after two days.

Frequently asked questions

Do I need a custom URL?

You need one when the hosting page is on a domain that does not share a parent domain with your instance.

Can visitors sign in from the widget?

Yes, if your instance uses an external SSO provider and the hosting site uses the same one. Add the SSO script, and list each redirect target in the login redirect property.

Why does the widget not appear in Safari?

The legacy iframe method does not run in Safari by default, because Apple blocks cross-origin frames. The portable widget also loads in an inline frame, so test it in Safari before it goes live.

Why did my greeting change not show up?

Instances upgraded from the New York release keep two older greeting properties, and those override the updated Greeting topic. Delete both properties and start a fresh conversation.