Skip to main content

Set Up Pick Ticket Status

When an agent has picked up a ticket in the broadcast channel, it will be useful to display the ticket status to keep everyone in the channel on the same page.

As this function is only applicable to Slack, you should create a new tree before proceeding. Please also set up the rest of the Slack commands in this tree.


What is your Result?

Unassigned Ticket Status
Unassigned Ticket Status
Pick Ticket Status
Ticket status before & after picking a ticket
note

Please remember to connect your Slack Channel on Stella before testing for the result.


Sample Tree Structure - Pick Ticket Status

Slack Command Tree Structure for Pick Ticket Status
Slack Command Tree Structure for Pick Ticket Status

You can click here to download the sample tree.


Getting Hands-on

Enter your Bot Builder and starting building your tree.

Create a Tree Node - Pick Ticket

  1. Create a new tree for Slack commands and name it is "Slack Command Tree".
Create the Slack Command Tree
Create the Slack Command Tree
  1. In the "Slack Command Tree", create a tree node and create a response. Then, put the following code in Advanced -> Transform:
Add code to transformed response
Add code to transformed response
note

The following code is for displaying the processing ticket status. You can change the processing text in "fallback" under "attachments".

return new Promise((resolve, reject) => {
let name
if (this.lodash.get(this.member, "profile.first_name")) {
name = `${this.member.profile.first_name} ${this.member.profile.last_name || ""}`
} else {
name = this.lodash.get(this.member, "profile.real_name")
}
resolve({
type: "ATTACHMENT",
text: this.messageEvent.data.originalMessage.text.replace(/\+/g, " "),
attachments: [
{
text: `Processing by ${name}`,
fallback: `Processing by ${name}`,
color: "#36a64f"
}
],
replaceOriginal: true
})
})

Create Pick Ticket Message (Optional)

  1. If needed. you can also send an automated message to the user when a ticket is picked up by an agent. To do so, you can simply add the following code to the post-actions of the tree node.

    You can customize the text message in text under response.

return new Promise(async (resolve, reject) => {
try {
let assignmentId = null
if (this.lodash.get(this.messageEvent, "data.payload.value") !== "GET_FIRST_ASSIGNMENT") {
assignmentId = this.lodash.get(this.messageEvent, "data.payload.value", null)
}
if (assignmentId) {
const assignment = await this.getAssignment({
assignmentId
})
if (assignment.member) {
const member = await this.getMember({ memberId: assignment.member })
let response
if (/zh/g.test(this.lodash.get(member, "locale", ""))) {
response = {
type: "TEXT",
text: "ζˆ‘ε€‘ε·²η‚Ίζ‚¨θ―ηΉ«δΊ†ζˆ‘ε€‘ηš„δ»£θ‘¨γ€‚"
}
} else {
response = {
type: "TEXT",
text: "We have connected you to our representative."
}
}

await this.sendMessageToInlet({
groupId: assignment.group,
channel: this.channel,
response,
})
console.log("sending message to inlet")
this.member.group = group
this.member.inletMember = member
resolve({
member: this.member
})
}
}
reject("Assignment or assignment member not found")
} catch (e) {
reject(e)
}
})

Create a Global Node - Pick Ticket

  1. Create a global node and then create a trigger with two conditions (for details on creating conditions, please click here with the and operator:
Pick Ticket Status Trigger for Slack
Pick Ticket Status Trigger for Slack

First condition - Type Payload:

this.messageEvent.type === "PAYLOAD"

Second condition - Pick Ticket:

this.lodash.get(this.messageEvent, "data.payload.payload") === "PICK_TICKET"
  1. Toggle Redirect to the tree node you created for pick ticket.
Redirect to Pick Ticket Tree Node
Redirect to Pick Ticket Tree Node

Add Tree to Slack Channel

  1. When you finish building the tree for picking ticket, please head to "Channels" and enter Slack channel you have created previosuly.

  2. In the Slack Channel, head to "Trees" -> "Settings", and add the tree under "Default Tree". Remember to select all the global nodes.

Add Tree to Slack Channel
Add Tree to Slack Channel
  1. Check and see if you can produce the expected outcome.