Skip to main content

Create Archive Function

Each live chat enquiry is displayed as a private channel on your Slack. If you have hundreds of channels flowing in everyday, then archiving will be a very useful function to keep your channel list tidy and clean.

Please set up this command in the Slack Command Tree you've created in Step 2.1.


What is your Result?

Archive Button on Slack
Archive Button on Slack
The archive button can be triggered after you have transferred or done the ticket
The archive button can be triggered after you have transferred or done the ticket
note

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


Sample Tree Structure for Archive Function

Slack Command Tree Structure for Archive Function
Slack Command Tree Structure for Archive Function

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 - Select Archive

  1. Create a tree node and name it as "Select Archive". Then, create a pre-action for the archive function with the following code:
return new Promise(async (resolve, reject) => {
try {
await this.slackArchiveConversation({
messageEvent: this.messageEvent,
channel: this.channel
})
resolve()
} catch (e) {
reject(e)
}
})

Create a Global Node - Select Archive

  1. Create a global node and name it as "Select Archive Global". Then, create a trigger with two conditions with the and operator:
Archive Button Trigger for Slack
Archive Button Trigger for Slack

First condition - Type Payload:

this.messageEvent.type === "PAYLOAD"

Second condition - ARCHIVE:

this.lodash.get(this.messageEvent, "data.payload") === "ARCHIVE"
  1. Toggle Redirect to the tree node you created for archiving.
Redirect to Slack Archive Tree Node
Redirect to Slack Archive Tree Node
tip

Before testing, please remember to update the tree and global node in the Slack Channel.

  1. Check and see if you can produce the expected outcome.