Skip to main content

Chat Suggest Packages Activity

Overview​

The Chat Suggest Packages (chat_suggest_packages) Activity allows suggesting packages within the first package enabling package nesting in Pia. With the Chat Suggest Packages Activity, you can define the packages that needs to be suggested during or after execution of the first package.

An example scenario where this activity may be used is in a troubleshooting package. You can define multiple packages within the primary package for the user to select from during the troubleshooting process.

The Chat Suggest Package activity can be located by searching for "Chat Suggest Packages" in the list of activities in the package editor:

Chat Suggest Packages

Here is a working sample of the activity in a basic package:

# Pia Automation Package
conditions:
- name: 'client_filter'
optMode: 'OptOut'
category: 'Hello World'

- name: 'chat'
option_button: 'Chat Suggest Package'
option_text: 'This is a test package'
option_category: 'Test Category'

steps:
- task: chat_interaction
inputs:
text: 'Hello!'

- task: chat_suggest_packages
inputs:
package_options: '1e310d26-e169-4ff5-9dc9-01b84734781f, 1730ef05-7a7e-4048-b5e9-18d2b522c4bd'
message: 'Select the package that you want to run:'

- task: chat_interaction
inputs:
text: 'Hello Again'

In the above example, a chat_suggest_package activity has been used suggest multiple packages within the primary package. When the primary package runs, you will see the following suggestions in Pia chatbot:

Chat Flow

Activity Behaviour​

The primary behaviour of the Chat Suggest Packages activity is to allow the users to select a package to run after the current package execution (detached). However, this behaviour can be modified to run the package within the first package execution (inline).

If the Chat Suggest Packages activity is the last activity in a package and the mode is set to 'detached', then the package will complete execution without waiting for the user's input. When the activity runs, it will check whether the packages that are being suggested are available to the client or not. The activity will only suggest packages that are available for the client i.e. if the package has been 'Opted In' for the client.

If the user selects a package to run from the suggested package, the live package view will show separate records for the suggested package execution and the primary execution.

The Chat Suggest Packages Activity can only be used in package executions which have been initiated via the Pia Chatbot (i.e. this activity will not work in cases where the package was initiated via Schedule or Ticketing System Event).

Features of the Chat Suggest Packages Activity

The main feature of the Chat Suggest Packages activity is to allow the user to select a second package to run during or after the execution of the first package. Apart from that, this activity also has following additional features:

  1. You can define multiple packages to be suggested within the parent package
  2. You can add text to show more information about the suggestion to the user
  3. With the chat suggest packages activity, you can define two types of behaviour for the nested package:
    • Detached Mode: where the nested package will run after the execution of the first package no matter where the activity has been placed in the first package.
    • Inline Mode: where depending on where the nested package has been placed, Pia will pause the current package execution, run the nested package, and resume current package execution after the nested package is executed. In this mode, if the nested package is cancelled or has failed, Pia will return back to execution of the first package

An example of each feature above is available at the bottom of this article.

Input Properties​

Use properties to modify the behaviour of the activity.

Property Name: package_options
Property Required: Yes
Property Description: A comma separated list of package internal ids OR classifications (Type|SubType|Item). Example: '7326451f-d8ce-4477-8a73-4ed78e59e080,TYPE|SUBTYPE|ITEM,7326451f-d7ce-4477-8a73-4ed78e59e080'

package_options

Property Name: message
Property Required: No
Property Description: The text message to show to the user in the chatbot.

message

Property Name: mode
Property Required: Yes
Property Options: 'Detached' or 'Inline'
Default Value: Detached
Property Description: Detached will start new package after current package execution. Inline pause current package execution, start a second package and resume current package once the second package is complete.

mode

Output Properties​

These are the properties which the Chat Suggest Package activity makes available:

Property Name: package_selected
Property Values: 'true' or 'false'
Property Description: If this is true, a package was selected for execution. If this is false, a package was not selected

Property Name: package
Property Description: The internal id of the package which was selected. This will be empty if the user did not select a package

Property Name: package_available
Property Value: 'true' or 'false'
Property Description: If this is true, the packages were available and a list was displayed to the user. If this is false, packages were not available and were not displayed to the user

Examples​

Inline Mode
Here is an example package that shows runs the second package in an inline mode.

# Pia Automation Package
conditions:
- name: 'client_filter'
optMode: 'OptOut'
category: 'Hello World'

- name: 'chat'
option_button: 'Chat Suggest Package'
option_text: 'This is a test package'
option_category: 'Test Category'

steps:
- task: chat_interaction
inputs:
text: 'Hello!'

- task: chat_suggest_packages
inputs:
package_options: '1e310d26-e169-4ff5-9dc9-01b84734781f, 1730ef05-7a7e-4048-b5e9-18d2b522c4bd'
message: 'Select the package that you want to run:'
mode: 'inline'

- task: chat_interaction
inputs:
text: 'Hello Again'

When the package runs, Pia will pause the execution of first package, run the selected package and resume back to the first package after the nested package has finished execution.

Example 1

Detached Mode
If the suggested packages need to be executed after the execution of the first package, change the mode to 'detached' as below:

- task: chat_suggest_packages
inputs:
package_options: '1e310d26-e169-4ff5-9dc9-01b84734781f, 1730ef05-7a7e-4048-b5e9-18d2b522c4bd'
message: 'Select the package that you want to run:'
mode: 'detached'

Here , the output will be as below:

Example 2