Workitem Variables (Workflow, Function and REST API)

Workitem Variables (Workflow, Function and REST API)

Overview

In the Thrio System, in the Workflow and Rest API can interact with workitem objects. These workitem objects have fields that users can extract and manipulate. Users can extract information from the fields to do something, use fields to test and use javascript functions.

JavaScript expression that returns the last 10 digits of the incoming phone number


workitem.from.slice(-10)

If the variable name is a substring of a string then the variable is indicated by the dollar sign and curly braces (${<variable name>}). This will indicate to the system to grab the value of the from field of the workitem object ${workitem.from}. The previous annotation $V. is deprecated and will be removed in a future release. When using strings in condition, they must be enclosed between quotes.

Enclose string between quotes when used in condition


'InboundCall'

All fields are read-only with the exception of the data field. A field is a string, number, or boolean. A workitem object is made of many fields. A data field returns an object the user can modify which is the only thing a user can manipulate. That data field will also contain fields assigned at different part of the application when passing context to it.

Workitem fields

The following are the fields of the workitem, their description and possible values. All fields are in read-only mode to the exception of the data field. That field is an object that can store the different fields.

ackEmail

Object representing the acknowledgment email that was sent automatically.

agentUsername

String representing the username of the user that has the workitem assigned to him.

assignedAt

Unix timestamp in milliseconds when the workitem was assigned to a user. You can create a JavaScript date by using the new Date(workitem.assignedAt) function.

businessEvents

Contains all the business events defined in the system. You can access the specific business event by adding the name. For example, if a business event called holiday is defined you can validate if it falls inside the time range or not by calling workitem.businessEvents.holiday. As the Business Events name is used in a variable, there can’t be any spaces or dashes/spaces in it’s name. It will return true if the current time falls inside the time range specified in the Time Events that are contained in the business event or will return false if the current time falls outside the time range.

callId

Unique ID for the call assigned by the telco.

campaignId

Campaign ID the workitem belongs to.

categoryId

The category ID assigned by the system to the workitem.

channelAvailability

When using the “Queue Data” component, this object will be populated with the information from the queue(s) specified. The object is composed of:

  • availableAgents - Number of available agents to the specified queue(s).
  • loggedAgents - Number of logged in agents to the specified queue(s).
  • chat - Object containing queue information for the specified queue(s) for the chat media. Currently available is the estimated waiting time in seconds.
  • email - Object containing queue information for the specified queue(s) for the email media. Currently available is the estimated waiting time in seconds.
  • social - Object containing queue information for the specified queue(s) for the social media. Currently available is the estimated waiting time in seconds.
  • sms - Object containing queue information for the specified queue(s) for the SMS media. Currently available is the estimated waiting time in seconds.
  • voice - Object containing queue information for the specified queue(s) for the voice media. Currently available is the estimated waiting time in seconds.

JSON representation of the channelAvailability field


"channelAvailability": {

"availableAgents" : 5,

"loggedAgents" : 9,

"chat": {

"estimatedWaitTimeInSeconds": 30

}

"email": {

"estimatedWaitTimeInSeconds": 30

}

"social": {

"estimatedWaitTimeInSeconds": 30

}

"sms": {

"estimatedWaitTimeInSeconds": 30

}

"voice": {

"estimatedWaitTimeInSeconds": 30

}

}

channelType

The channel type for this workitem. Possible values are:

  • Chat
  • Email
  • Social
  • SMS
  • Voice

chatMessages

Array of objects containing the chat communication between the user and the customer. The object is composed of:

  • id - Unique ID of the message.
  • timestamp - Unix timestamp in milliseconds when the workitem was sent.
  • fromId - Unique ID of the sender.
  • toId - Unique ID of the recipient.
  • type - Where the message came from. Possible values are USER, CLIENT and BOT.
  • textMsg - Actual text message.
  • viewedBy - Object representing who actually viewed the message.

contact

Contact object if a contact was assigned to the workitem. The fields of the contact depends on the implementation that was done.

contactAddress

Address (phone number, email address or userId) that was received or sent based on the workitem type. Similar to to and from but the system assigns it based on the type.

contactId

Unique ID for the contact if a contact was assigned to the workitem.

currentChatMessage

Object containing the current chat message(s) between the user and the customer. The object is composed of:

  • id - Unique ID of the message.
  • timestamp - Unix timestamp in milliseconds when the workitem was sent.
  • fromId - Unique ID of the sender.
  • toId - Unique ID of the recipient.
  • type - Where the message came from. Possible values are USER, CLIENT and BOT.
  • textMsg - Actual text message.
  • viewedBy - Object representing who actually viewed the message.

currentSMSMessage

Object containing the current SMS message(s) between the user and the customer. The object is composed of:

  • id - Unique ID of the message.
  • timestamp - Unix timestamp in milliseconds when the workitem was sent.
  • fromId - Unique ID of the sender.
  • toId - Unique ID of the recipient.
  • type - Where the message came from. Possible values are USER, CLIENT and BOT.
  • textMsg - Actual text message.
  • viewedBy - Object representing who actually viewed the message.

data

Data field that holds custom fields received or created in the workflow.

dialedAt

Unix timestamp in milliseconds when the workitem was dialed.

digits

Contains the last digit that has been entered in a Play and Collect Digits or a Get Digits component.

dispositionedAt

Unix timestamp in milliseconds when the workitem was dispositioned by an agent or the system.

dispositionId

Unique ID for the disposition if a workitem was dispositioned.

dispositionName

Name of the disposition.

dispositionNote

Note entered when the workitem was dispositioned.

email

Object holding the email received by the campaign. The object is composed of:

  • bodyParts - Actual email or attachments.
  • ccAddresses - Array of objects representing the CC email addresses. Object is composed of name and email fields.
  • subject - Subject of the email.
  • to - Recipient’s email address.

from

Address (phone number, email address or userId) that was received or sent the workitem based on the workitem type.

  • If placing an outbound workitem, this would contain the address from the campaign.
  • If receiving an inbound workitem, this would contain the customer’s address.

language

Language detected or assigned for this workitem.

lead

Lead object if the workitem is of type PredictiveCall, PredictiveSMS or ProgressiveCall. The fields of the lead depends on the implementation that was done.

offeredAt

Unix timestamp in milliseconds when the workitem was offered to a user.

ownedBy

Owner of the workitem. Possible values are:

  • Agent
  • OTHERS, NEED TO VALIDATE WITH RAN

ownedById

Unique ID of the current owner of the workitem.

personalCallbackTime

Represents the time the callback was scheduled for.

priority

Priority assigned to the workitem.

queuedAt

Unix timestamp in milliseconds when the workitem entered a queue.

queues

Queue IDs representing the queues that could have answered the workitem.

regionId

A region as defined by the system where this workitem has been processed.

responseEmail

Object holding the email response. The object is composed of:

  • bodyParts - Actual email or attachments.
  • ccAddresses - Array of objects representing the CC email addresses. Object is composed of name and email fields.
  • subject - Subject of the email.
  • to - Recipient’s email address.

selectedQueue

Queue ID representing the queue that answered the workitem.

smsMessages

Array of objects containing the SMS communication between the user and the customer. The object is composed of:

  • id - Unique ID of the message.
  • timestamp - Unix timestamp in milliseconds when the workitem was sent.
  • fromId - Unique ID of the sender.
  • toId - Unique ID of the recipient.
  • type - Where the message came from. Possible values are USER, CLIENT and BOT.
  • textMsg - Actual text message.
  • viewedBy - Object representing who actually viewed the message.

state

State if the workitem. Possible values are:

  • Accepted
  • Active
  • Conference
  • Dispositioned
  • Hold
  • History
  • Inreview
  • Offered
  • Terminated
  • Transfer
  • Voicemail

surveyId

Unique ID of the survey currently assigned to the workitem. This surveyId can be change in the workflow by using the survey component.

surveyResult

Complete survey result entered by the customer.

terminatedAt

Unix timestamp in milliseconds when the workitem was terminated.

thrioMessages

Array of strings that will be presented to the user when a workitem is presented to the user.

time (Deprecated)

Deprecated, use BussinessEvents instead of verifying if the workitem can be process / answer or not. Object containing the current time. The object is composed of:

  • currentHour - Returns the current hour (24 hour format).
  • currentMin - Returns the current minute.
  • currentSec - Returns the current seconds.
  • currentDayOfWeek - Returns the day of the week in a numerical value, where Monday = 1, Tuesday = 2, etc.
  • currentDayOfMonth - Returns the current month as a numerical value, where January = 1, February = 2, etc.
  • currentYear - Returns the current 4 digit year.


"time": {

"currentHour" : 10,

"currentMin" : 50,

"currentSec" : 0,

"currentDayOfWeek" : 5,

"currentDayOfMonth" : 11,

"currentYear" : 2019

}

to

Address (phone number, email address or userId) that was received or sent based on the workitem type.

  • If making an outbound workitem, this would contain the address the system or agent used.
  • If receiving an inbound workitem, this would contain the address the customer used to enter the system.

type

Indicates the current type of the workitem. Possible values are:

  • Chat
  • Email
  • InboundCall
  • InboundExtensionCall
  • InboundFax
  • InboundSMS
  • OutboundCall
  • OutboundEmail
  • OutboundExtensionCall
  • OutboundFax
  • OutboundSMS
  • PredictiveCall
  • PredictiveSMS
  • ProgressiveCall
  • Social
  • Survey
  • SystemCall

workitemId

Unique ID for the workitem assigned by the Thrio.

Click Here to Download Linked File

What’s a Rich Text element?

The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.

Static and dynamic content editing

A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!

How to customize formatting for each rich text

Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.