The Problem
Moveworks has a native ServiceNow approvals flow that includes three plugins (Approval Information, Update Approval Record, and List of Approvals). In a perfect scenario, the user would simply ask to show details on their approvals and ask to approve only one record at a time. The more common scenario, users ask to approve multiple records at once and because the chat bot supports planning it will attempt to complete this task and sometimes it can work, but most of the time it fails.

The Solution
We can disable the native plugins and create a custom plugin that supports bulk actions and recreates the native functionality. The downside to this approach is that the calls would be real time and I suspect the native plugins ingest the approval details which is why it serves the info so quickly. We opted for a hybrid approach where users would opt into the bulk approval plugin (we had some users who had hundreds of approvals to get through) while the majority population would stay on with the native approvals from Moveworks.
Conversational Process
Slots
We use two slots in this plugin, one of the slots captures the user’s desired action (take a bulk action, view more details on the approvals, take no action). The second slot only gets filled if the user decides to take a bulk action, it stores the user’s choice to bulk approve or bulk reject the records. We use static resolver methods for both slots to present a list of selectable options to the user.

Decision Policies
We created 3x decision policies, the first one checks if the user has any pending approvals to show (data.ok_approvals.result[0] == None). The second one checks the slot value to see if the user wants to take a bulk action or view more details on the pending approvals. The third and final one checks if the user wants to approve or reject the pending approvals.

Compound Action
We created two compound actions for this plugin, one for the bulk action and the other for the more details action. For the first compound action we use an API to get a list of approvals and loop over it and set each record to approve/reject based on the earlier slot value we collected. In the second compound action we also use an API to get a list of approvals and loop over each record and return more granular details to the user.

API’s Needed
We use 3x main API’s to make this plugin work. The first API queries (GET) the ServiceNow endpoint “/api/now/table/sysapproval_approver” to get a list of all the approval records a user has. We capped the actions to only return 100x records at a time (sysparm_limit = 100). The second API queries (GET) the ServiceNow endpoint “/api/now/table/sc_req_item” to return more granular details on a given record. The third and final API calls (PATCH) the ServiceNow endpoint “/api/now/table/sysapproval_approver/{{sys_id}}” with the body passing in the value of the record to be set too { “state”: “approved”} or {“state”: “rejected”}.
Hope this helps anyone out there looking for something similar, let me know if you have questions 😎