Skip to main content

Get Package Data Activity

Overview​

The Get Package Data (get_package_data) Activity is a built in activity available in Pia that allows retrieving the stored data. You can retrieve information required for the current or any other package execution using this activity.

An example scenario where this activity is currently used in Pia is in the Re-enable Terminated Account Package. The package uses Get Package Data Activity to retrieve user data and use the retrieved information to re-enable the terminated user account.

The Get package Data activity can be located by searching for "Get Package" in the list of activities in the package editor:

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: 'Test Get Package Data'
option_text: 'This is a Test Package'
option_category: 'Test Category'

steps:
- task: store_package_data
inputs:
key: 'uniquekey_1'
value: 'Hello World'

- task: store_package_data
inputs:
key: 'uniquekey_2'
value: 'Hello'

- task: get_package_data
inputs:
key: 'uniquekey_1'

- task: chat_interaction
inputs:
text: =get_package_data.value

In the above package, the Get Package Data activity is retrieving one of the values storied using the Store Package Data activity. When the package executed in Pia chatbot, you will see the following:

Activity Behaviour​

The Get Package Data activity is primarily used to retrieve information, required for package execution, that has been stored in the database using the Store Package Data Activity.

The information retrieved by the Get Package Data activity is on a per package basis. By default, the data will be retrieved for the current executing package but you may modify the activity to retrieve data required for other packages as well. This data is also isolated to the sandbox or live mode (You cannot retrieve live data when the package is running in sandbox mode).

Additionally, you can filter the data being retrieved by using the unique key assigned to each data and filter expressions as input properties to this activity.

The Get Package Data Activity can be used in all types of package executions. This includes packages which have been initiated via the Pia Chatbot or via Ticketing System Event.

Input Properties​

Use properties to modify the behaviour of the activity.

Property Name: key
Property Required: Either key or filterExpression must be provided.
Property Description: Unique key used to retrieve data for this package. If you do not specify a key, all data for this package will be returned.

Property Name: filterExpression
Property Required: Either key or filterExpression must be provided. This is a RegEx Expression.
Property Description: This input property is used to filter keys in the database and return the corresponding data for each key.

Property Name: package_internal_id
Property Required: No
Property Description: Package to retrieve data for. If you do not specify, this will default to the current executing package.

Output Properties​

These is a single property that the Get Package Data activity makes available:

Property Name: value
Property Description: This is the value retrieved by the Get Package Data activity.