Get Approval Activity
Overviewβ
The Get Approval (get_approval) Activity was implemented as a part of Approval Feature. While the approval feature restricts Pia automations to be run only on the direction of certain staff members (approvers) from the client side, the Get Approval Activity allows you to send direct emails to them requesting approval to run the automation for the client.
The list of Approvers for each client can be defined in Pia Client Dashboard Screen. Alternatively, you can define the approver's email directly into the activity.
The Get Approval activity can be located by searching for "Get Approval" in the list of activities in the package editor:
Below is the working sample of the activity in a basic package:
# Orchestrator package
conditions:
- name: 'client_filter'
optMode: 'OptOut'
category: 'Testing'
- name: 'chat'
option_button: 'Approval Test'
option_text: 'This is a test package'
option_category: 'Test'
steps:
- task: get_approval
inputs:
message: 'Pia needs approval before starting this Package. Sending an email to the approver'
email_body: |
Test Email Body
- task: chat_interaction
inputs:
text: 'Hello World!'
Activity Behaviourβ
The Get Approval activity allows you to define approver for a Package. The email of the approver is retrieved either via direct input (using the input parameter) or by referring to the Approvers list in Client Dashboard > Approvers Tab.
if the activity retrieves the approver details from the Approvers list in Client Dashboard, the user will be prompted with two options during Package execution:
- Manual Approval
- Automatic Approval
By selecting manual approval, Pia assumes that the user has already received approval from the selected approver manually (via Phone or Email) and won't take any automatic action whereas by selecting automatic approval, you can prompt Pia to send an email to the selected approver.
The Get Approval Activity will then send an email to the selected approver and wait for them to respond to the email. Three consecutive emails are sent to the same or different approvers (based on selection made by the user) at 24 hours interval if there is no response. After the third email, Pia will inform the user that it could not get automatic approval and give the user two options:
- Get Automatic Approval
- Select Manual approver
The activity has input and output proprties that allows you to define the message to be displayed in chatbot for the engineer and also to define the body of the email being sent to the approver.
The Get Approval 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).
Input Propertiesβ
Use properties to modify the behaviour of the activity.
Property Name: ticket_id
Default Value: $Ctx_CW_Ticket_Id
Property Required: Yes
Property Description: The ticket id of the ticket to send the chat message to. This defaults to the ticket id for the current chat session and does not need to be set unless you want to override this behaviour.
Property Name: message
Property Required: No
Property Description: The message to be displayed to the engineer in chatbot while Pia sends an email to the approver.
Property Name: approver_email
Property Required: No
Property Description: This property allows you to specify the approver's email address within the package. Once an email is defined, the chatbot will no longer present the option to choose between manual or automatic approval. Instead, it will automatically send the approval request to the pre-defined email address of the approver and wait for their response.
Property Name: email_body
Property Required: No
Property Description: The text that would be displayed in the email sent to the client(approver) to get approval.
Property Name: retry_approval_on_cancel
Property Required: No
Property Options: 'true' or 'false'
Default Value: 'true'
Property Description: If this is set to 'true', Pia will prompt a retry message when the approval request is cancelled by the engineer. If this is set to 'false', Pia will not prompt anything when the approval request is cancelled.
Property Name: email_subject
Property Required: No
Property Description: Use this property to set the title of the approval email that is sent to the approver. If this is not defined, default subject will be used i.e. IT Approval Request for #TicketNumber.
Property Name: email_accept_button_name
Property Required: No
Property Description: This is the name of the accept button in the email that is sent to the approver during the approval process. If this is not defined, default button name will be used i.e. Approve.
Property Name: email_reject_button_name
Property Required: No
Property Description: This is the name of the reject button in the email that is sent to the approver during the approval process. If this is not defined, default button name will be used i.e. Decline.
Property Name: stoponReject
Property Required: No
Property Options: 'true' or 'false'
Property Description: If this is set to 'true', the package will stop package execution when the approver rejects the approval. If this is set to 'false' , Pia will complete the activity and move on to the next one with the output value 'Declined'.
Property Name: email_sent_message
Property Required: No
Property Description: This is the text that Pia will output in the chatbot when the email is sent to the approver. The default text is 'An email has been sent to the approver requesting approval'. If the value is left blank, Pia will not output chat message when the approval request is sent.
Property Name: email_waiting_message
Property Required: No
Property Description: This is the text that Pia will output in the chatbot when Pia is waiting on the automatic email approval. The default text is 'The process will automatically continue when I receive an approval from the approver'. If the value is left blank, Pia will not output chat message when waiting for approval.
Output Propertiesβ
Property Name: waiting_for_approval
Property Description: This will be 'true' if Pia is waiting on the approval from the approver and 'false' if Pia has already received a response.
Property Name: approver_name
Property Description: This is the name of the approver who approved the request.
Property Name: approver_email
Property Description: This is the email of the approver who approved the request.
Property Name: approval_type
Property Description: This will be 'Automatic' or 'Manual' based on the approval option selected by the engineer in the chatbot.
Property Name: approvalResult
Property Description: This will be 'Approved', 'Declined' or 'Cancelled' based on whether the approval request has been approved by the approver/declined by the approver/cancelled by the engineer in the chatbot.