Script Choice - Helper Method Information
This page lists all the helper methods that are available in the Route - Evaluate JavaScript chat pipeline item.
Each method is listed with its name, description, parameters, return type, and an example of how to use it.
runPrompt
Runs a prompt against the Azure OpenAI service
Example
runPrompt('sessionId', 'systemPrompt', parameters)
Parameters
string sessionId
string systemPrompt
ChatGptParameters? parameters
Returns
string response
Updated Metadata
none
summarizeConversation
Summarizes a chat conversation
Example
summarizeConversation('sessionId')
Parameters
string sessionId
Returns
ChatSessionSummarization result
Updated Metadata
none
translateText
Translates text to the specified language
Example
translateText('fr', 'Hello')
Parameters
string targetLanguage
string inputText
Returns
string translatedText
Updated Metadata
none
search_confluence_pages
Searches Confluence for Page content matching keywords
Example
var searchResult = search_confluence_pages(['email help', 'Outlook'])
Parameters
string[] keywords
Returns
PageSearchResult results
{
"originalQuery": "[email help, Outlook]",
"generatedKeywords": [
"email help",
"Outlook"
],
"pageCount": 1,
"summary": "Searching Confluence for '[email help, Outlook]' found 1 results",
"pages": [
{
"id": "12345",
"title": "How to set up email in Outlook",
"created": "2026-04-15T11:08:26.6251348-04:00",
"updated": "2026-04-15T12:19:26.6251348-04:00",
"bodyMarkdown: "This page provides instructions on how to set up your email account in Microsoft Outlook..."
"url": "https://confluence.example.com/wiki/spaces/UG/pages/12345/How-To+-+Setup+Email",
}
]
}
Updated Metadata
none
sendEmail
Sends an email with the specified parameters. The request object should include the subject, body, recipients, and whether the body is HTML.
{
"Recipient": "string, optional - single recipient email address",
"Recipients": "string array, optional - multiple recipient email addresses",
"CCRecipients": "string array, optional - CC recipient email addresses",
"BCCRecipients": "string array, optional - BCC recipient email addresses",
"Subject": "string, required - email subject",
"Body": "string, required - email body content",
"IsHtml": "boolean, required - indicates if the body is HTML"
}
Example
var result = sendEmail(request)
Parameters
EmailSendRequest request
Returns
EmailSendResult
{
"Success": bool,
"ErrorMessage": string
}
Updated Metadata
getFAQTags
Returns Tag List for FAQs
Example
getFAQTags()
Parameters
none
Returns
string tags
Updated Metadata
none
searchFAQByTag
Returns FAQs based on the tag in parameter and if you want full or filtered results
Example
searchFAQByTag('Training', true)
Parameters
string tag
bool full
Returns
string faq
Updated Metadata
none
searchFAQByTitleKeywords
Returns FAQs based on the keyword in the parameter and if you want full or filtered results
Example
searchFAQByTitleKeywords('Teams Meeting', false)
Parameters
string keywords
bool full
Returns
string faq
Updated Metadata
none
getUserOfficeLocation
Gets the office location of a user by their email address
Example
getUserOfficeLocation('user@example.com')
Parameters
string seekerEmailAddress
Returns
string userOfficeLocation
Updated Metadata
none
getUser
Gets user details by their email address
Example
getUser('user@example.com')
Parameters
string emailAddress
Returns
string userDetailsJson
Updated Metadata
none
getADUserObject
Gets the Active Directory user object by their email address
Example
getADUserObject('user@example.com')
Parameters
string emailAddress
Returns
string adUserObjectJson
Updated Metadata
none
createMeetingWithJoinUrl
Creates a Teams meeting with a join URL
Example
createMeetingWithJoinUrl()
Parameters
Returns
string meetingDetailsJson
Updated Metadata
none
getGroup
Gets group details by their display name
Example
getGroup('groupName')
Parameters
string groupName
Returns
string groupDetailsJson
Updated Metadata
none
getGroupMembers
Gets the list of members for a specific group by name
Example
getGroupMembers('group name')
Parameters
string groupName
Returns
string[] membersEmail
Updated Metadata
none
isMemberOfGroup
Checks if a user with the given email is a member of the specified group ID
Example
isMemberOfGroup('user@example.com', 'group-id-guid')
Parameters
string emailAddress
string groupId
Returns
bool isMember
Updated Metadata
none
getUserGroups
Gets the list of group names that the user belongs to by their email address
Example
getUserGroups('user@example.com')
Parameters
string emailAddress
Returns
string[] groupNames
Updated Metadata
none
getOngoingOutages
Gets a list of ongoing outages
Example
const outages = getOngoingOutages()
Parameters
none
Returns
OutageModel[]
Updated Metadata
none
getFutureOutages
Gets a list of upcoming and current outages scheduled before a date
Example
const outages = getFutureOutages(new Date(2026, 4, 1))
Parameters
Date beforeDate
Returns
OutageModel[]
Updated Metadata
none
getOutage
Gets details of an outage by its content item id
Example
const outage = getOutage('45eyefka863v0yammz6rr22txz')
Parameters
string contentItemId
Returns
OutageModel
{
"ContentItemId": "45eyefka863v0yammz6rr22txz",
"Title": "Azure is down since 10/29/2025 11:30am - Access to the Azure Portal and Graph API is impacted",
"ViewLink": "https://app.imchime.com/ExampleCo/Contents/ContentItems/45eyefka863v0yammz6rr22txz",
"Status": 1,
"Severity": 2,
"StartOutageUtc": "2025-10-30T00:08:00+00:00",
"PlannedEndUtc": null,
"MarkdownBody": "Access to the Azure portal is unavailable due to network maintenance",
"ResolvedAtUtc": null,
"IsResolved": false
}
Updated Metadata
none
getAgentListById
Returns an AgentListRecord by its ID
Example
getAgentListById('agentListId')
Parameters
string agentListId
Returns
AgentListRecord agentList
Updated Metadata
none
updateSessionMetaData
Updates session metadata with a key-value pair.
Example
updateSessionMetaData('Guest.Question','Hi, I need to reset my email password');
Parameters
string metaDataKey
string metaDataValue
Returns
string status
Updated Metadata
string metaDataValue
sendReply
Sends a chat message to the Guest User
Example
sendReply('Please wait, we are connecting you to an available Agent')
Parameters
string message
Returns
string status
Updated Metadata
none
newContentMethod
Returns a new Content Item based on the type defined by string
Example
newContent(ChatAttachmentItem)
Parameters
string contentType
Returns
IContent contentType
Updated Metadata
none
createContentMethod
Creates and can publish a Content Item based on the parameters
Example
createContent(ChatAttachmentItem, true, {jsonObject})
Parameters
string contentType
bool? publish
object properties
Returns
ContentItem contentItem
Updated Metadata
none
createCustomContentMethod
Creates and can publish a Content Item based on json included in the parameter
Example
createCustomContent('FAQItem', true, {jsonObject})
Parameters
string contentType
bool? publish
object properties
Returns
ContentItem contentItem
Updated Metadata
none
markChatAsTest
Marks the current chat session as a test chat
Example
markChatAsTest()
Parameters
none
Returns
string status
Updated Metadata
Session.IsTestChat, True
markDeflected
Marks the current chat with deflected/notdeflected based on the parameter. If it's deflected, changes the session state to Deflected
Example
markDeflected(true)
Parameters
bool isDeflected
Returns
string status
Updated Metadata
Session.Deflected, true/false
Session.State, Deflected
markDeflectedByCustom
Marks the current chat with deflected and sets the reason to the custom parameter you include. Changes the session state to Deflected
Example
markDeflectedByCustom('InactiveChat')
Parameters
string reason
Returns
string status
Updated Metadata
Session.Deflected, true
Session.DeflectedBy, reason
Session.State, Deflected
markDeflectedByFaqLookup
Marks the current chat with deflected and sets the reason to FAQLookup. Changes the session state to Deflected
Example
markDeflectedByFaqLookup()
Parameters
none
Returns
string status
Updated Metadata
Session.Deflected, true
Session.DeflectedBy, FAQLookup
Session.State, Deflected
markDeflectedByTicketListing
Marks the current chat with deflected and sets the reason to ShowTickets. Changes the session state to Deflected
Example
markDeflectedByTicketListing()
Parameters
none
Returns
string status
Updated Metadata
Session.Deflected, true
Session.DeflectedBy, ShowTickets
Session.State, Deflected
markDeflectedByTicketCreation
Marks the current chat with deflected and sets the reason to Ticketing. Changes the session state to Deflected
Example
markDeflectedByTicketCreation()
Parameters
none
Returns
string status
Updated Metadata
Session.Deflected, true
Session.DeflectedBy, Ticketing
Session.State, Deflected
markDeflectedByOutageDisplay
Marks the current chat with deflected and sets the reason to Outage. Changes the session state to Deflected
Example
markDeflectedByOutageDisplay()
Parameters
none
Returns
string status
Updated Metadata
Session.Deflected, true
Session.DeflectedBy, Outage
Session.State, Deflected
markDeflectedByAIAssist
Marks the current chat with deflected and sets the reason to AI Assist. Changes the session state to Deflected
Example
markDeflectedByAIAssist()
Parameters
none
Returns
string status
Updated Metadata
Session.Deflected, true
Session.DeflectedBy, AI Assist
Session.State, Deflected
markDeflectedByOffHours
Marks the current chat with deflected and sets the reason to Off Hours. Changes the session state to Deflected
Example
markDeflectedByOffHours()
Parameters
none
Returns
string status
Updated Metadata
Session.Deflected, true
Session.DeflectedBy, Off Hours
Session.State, Deflected
noUserResponseCustomReason
Marks the current chat with NoUserResponse and sets the reason to the custom parameter you include
Example
noUserResponseCustomReason('InactiveChat')
Parameters
string reason
Returns
string status
Updated Metadata
NoUserResponse, true
NoUserResponse.Reason, reason
noUserResponseAfterFAQLookup
Marks the current chat with NoUserResponse and sets the reason to NoUserResponse.AfterFAQLookup
Example
noUserResponseAfterFAQLookup()
Parameters
none
Returns
string status
Updated Metadata
NoUserResponse, true
NoUserResponse.Reason, NoUserResponse.AfterFAQLookup
noUserResponseAfterTicketListing
Marks the current chat with NoUserResponse and sets the reason to NoUserResponse.AfterTicketListing
Example
noUserResponseAfterTicketListing()
Parameters
none
Returns
string status
Updated Metadata
NoUserResponse, true
NoUserResponse.Reason, NoUserResponse.AfterTicketListing
noUserResponseAfterTicketCreation
Marks the current chat with NoUserResponse and sets the reason to NoUserResponse.AfterTicketCreation
Example
noUserResponseAfterTicketCreation()
Parameters
none
Returns
string status
Updated Metadata
NoUserResponse, true
NoUserResponse.Reason, NoUserResponse.AfterTicketCreation
noUserResponseAfterOutageDisplay
Marks the current chat with NoUserResponse and sets the reason to NoUserResponse.AfterOutageDisplay
Example
noUserResponseAfterOutageDisplay()
Parameters
none
Returns
string status
Updated Metadata
NoUserResponse, true
NoUserResponse.Reason, NoUserResponse.AfterOutageDisplay
noUserResponseAfterAIAssist
Marks the current chat with NoUserResponse and sets the reason to NoUserResponse.AfterAIAssist
Example
noUserResponseAfterAIAssist()
Parameters
none
Returns
string status
Updated Metadata
NoUserResponse, true
NoUserResponse.Reason, NoUserResponse.AfterAIAssist
noUserResponseAfterFeedbackCard
Marks the current chat with NoUserResponse and sets the reason to NoUserResponse.AfterFeedbackCard
Example
noUserResponseAfterFeedbackCard()
Parameters
none
Returns
string status
Updated Metadata
NoUserResponse, true
NoUserResponse.Reason, NoUserResponse.AfterFeedbackCard
noUserResponseAfterQuestionPrompt
Marks the current chat with NoUserResponse and sets the reason to NoUserResponse.AfterQuestionPrompt
Example
noUserResponseAfterQuestionPrompt()
Parameters
none
Returns
string status
Updated Metadata
NoUserResponse, true
NoUserResponse.Reason, NoUserResponse.AfterQuestionPrompt
noUserResponseAfterOffHoursPrompt
Marks the current chat with NoUserResponse and sets the reason to NoUserResponse.AfterOffHoursPrompt
Example
noUserResponseAfterOffHoursPrompt()
Parameters
none
Returns
string status
Updated Metadata
NoUserResponse, true
NoUserResponse.Reason, NoUserResponse.AfterOffHoursPrompt
setUserIsVIP
Marks the current user as a VIP by updating session metadata
Example
setUserIsVIP();
Parameters
None
Returns
string status
Updated Metadata
Guest.IsVIP, True
setUserJobTitle
Updates the Guest Job Title session metadata for the current session based on the parameter
Example
setUserJobTitle('Sales Director')
Parameters
string jobTitle
Returns
string status
Updated Metadata
Guest.JobTitle, jobTitle
setUserOfficeLocation
Updates the Guest Office Location session metadata for the current session based on the parameter
Example
setUserOfficeLocation('Boston')
Parameters
string userOfficeLocation
Returns
string status
Updated Metadata
Guest.OfficeLocation, userOfficeLocation
setUserAccountInformation
Sets account info to later be added to tickets or to give Agents additional information about the Guest
Example
setUserAccountInformation('9348743','Sales Members','Sales')
Parameters
string accountNumber
string accountName
string accountResponsible
Returns
string status
Updated Metadata
Guest.AccountNumber, accountNumber
Guest.AccountName, accountName
Guest.AccountResponsible, accountResponsible
setDashboardText
Updates the metadata for the dashboard text
Example
setDashboardText('VIP user jobTitle')
Parameters
string dashboardText
Returns
string status
Updated Metadata
Session.Dashboard.Text, dashboardText
setDashboardIcon
Updates the metadata for the dashboard icon (vip, info, warning)
Example
setDashboardIcon('vip')
Parameters
string dashboardIcon
Returns
string status
Updated Metadata
Session.Dashboard.Icon, vip
makeHttpGetRequest
Make HTTP get request
Example
makeHttpGetRequest(link)
Parameters
none
Returns
string JSON
Updated Metadata
none
getChatTranscript
Get Session Transcript
Example
getChatTranscript()
Parameters
none
Returns
string transcript
Updated Metadata
none
toJson
Convert object to json
Example
toJson({"foo":"bar"})
Parameters
object obj
Returns
string JSON
Updated Metadata
none
getFullTranscript
Returns the full transcript of the session
Example
getFullTranscript()
Parameters
Returns
List<IMessageActivity> transcript
Updated Metadata
none
getLastGuestMessage
Returns the last message sent by the guest in the session
Example
getLastGuestMessage()
Parameters
Returns
IMessageActivity lastMessage
Updated Metadata
none
getInitialMessage
Returns the initial message of the session
Example
getInitialMessage()
Parameters
Returns
IMessageActivity initialMessage
Updated Metadata
none
getAverageSpeedToAnswer
Returns the average speed to answer for a given number of hours back
Example
getAverageSpeedToAnswer(24)
Parameters
int hoursBack
Returns
TimeSpan averageSpeed
Updated Metadata
none
getLongestWaiting
Returns the longest waiting time in the system
Example
getLongestWaiting()
Parameters
Returns
TimeSpan longestWaiting
Updated Metadata
none
getAllMetadata
Returns all metadata for a session
Example
getAllMetadata('sessionId')
Parameters
string sessionId
Returns
Dictionary<string, string> metadata
Updated Metadata
none
getMetadataValue
Returns a specific metadata value for a session
Example
getMetadataValue('sessionId', 'key')
Parameters
string sessionId
string key
Returns
string value
Updated Metadata
none
createInstantTicket
Creates an instant ticket
Example
var ticketId = createInstantTicket(title, description, guestName, guestEmail, priority, agentId)
Parameters
string title
string description
string guestName
string guestEmail
string priority (optional)
string agentId (optional)
Returns
int TicketId
Updated Metadata
none
getInstantTicketsForGuest
Gets instant tickets for a guest by name or email
Example
getInstantTicketsForGuest(guestNameOrEmail)
Parameters
string guestNameOrEmail
Returns
string JSON array of tickets
Updated Metadata
none
getInstantTicketDetails
Gets details of an instant ticket by ticket ID
Example
getInstantTicketDetails(ticketId)
Parameters
int ticketId
Returns
string JSON object of ticket details
Updated Metadata
none
updateInstantTicketDescription
Updates the description of an instant ticket
Example
updateInstantTicketDescription(ticketId, description)
Parameters
int ticketId
string description
Returns
string 'true' if successful, 'false' otherwise
Updated Metadata
none
assignInstantTicket
Assigns an instant ticket to an agent
Example
assignInstantTicket(ticketId, agentId)
Parameters
int ticketId
string agentId
Returns
string 'true' if successful, 'false' otherwise
Updated Metadata
none
resolveInstantTicket
Resolves an instant ticket with an optional reason
Example
resolveInstantTicket(ticketId, reason)
Parameters
int ticketId
string reason (optional)
Returns
string 'true' if successful, 'false' otherwise
Updated Metadata
none
setInstantTicketPriority
Sets the priority of an instant ticket
Example
setInstantTicketPriority(ticketId, priority)
Parameters
int ticketId
string priority
Returns
string 'true' if successful, 'false' otherwise
Updated Metadata
none
associateInstantTicketWithChatSession
Associates an instant ticket with a chat session
Example
associateInstantTicketWithChatSession(ticketId, chatSessionId)
Parameters
int ticketId
string chatSessionId
Returns
string 'true' if successful, 'false' otherwise
Updated Metadata
none
linkInstantTicketToOtherTicket
Links an instant ticket to another ticket
Example
linkInstantTicketToOtherTicket(ticketId, linkedTicketId)
Parameters
int ticketId
int linkedTicketId
Returns
string 'true' if successful, 'false' otherwise
Updated Metadata
none
InstantTicket_addAdditionalContact
Adds an additional contact to an instant ticket
Example
addAdditionalContact(ticketId, name, email, phone)
Parameters
int ticketId
string name
string email
string phone (optional)
Returns
string 'true' if successful, 'false' otherwise
Updated Metadata
none
setInstantTicketTitle
Sets the title of an instant ticket
Example
setInstantTicketTitle(ticketId, title)
Parameters
int ticketId
string title
Returns
string 'true' if successful, 'false' otherwise
Updated Metadata
none
setInstantTicketDueDate
Sets the due date of an instant ticket
Example
setInstantTicketDueDate(ticketId, dueDateString)
Parameters
int ticketId
string dueDateString (optional, in ISO 8601 format)
Returns
string 'true' if successful, 'false' otherwise
Updated Metadata
none
setInstantTicketContact
Sets the contact info of an instant ticket
Example
setInstantTicketContact(ticketId, name, email, phone)
Parameters
int ticketId
string name
string email
string phone (optional)
Returns
string 'true' if successful, 'false' otherwise
Updated Metadata
none
getServiceNowTickets
Gets ServiceNow Tickets for the email address in parameter
Example
getServiceNowTickets(guest@email.com)
Parameters
string guestEmailAddress
Returns
string tickets
Updated Metadata
none
createServiceNowTicket
Creates a ServiceNow Tickets based on the jsonObject you pass in through the parameter
Example
createServiceNowTicket(jsonObject)
Parameters
string json
Returns
string result
Updated Metadata
none
updateServiceNowTicket
Upates an existing ServiceNow ticket based on the json and id you pass in through the parameter
Example
updateServiceNowTicket(jsonObject, ticketId)
Parameters
string json
string id
Returns
string result
Updated Metadata
none
guid
Generates a new GUID
Example
guid()
Parameters
Returns
string guid
Updated Metadata
none