Hi @andrewwhitley ,
Good news — this type of plugin is now possible with our new Notify feature in compound actions. Below is a step-by-step outline of how you can implement it. NOTE: This will require you are on our Limited Preview for webhooks.
1. Triggering the Plugin
- Your workflow starts with a webhook.
- The webhook should trigger your plugin that has a listener configured; that plugin has a compound action set as its system body.
- Make sure the webhook passes the email address of the person who needs to approve along with any pertinent details for the approval as an input argument.
2. Resolving the User
- Within the compound action, use the input email with the get_user_by_email action.
- This will return the user’s ID, which you’ll use to personalize the next step.
3. Sending the Notification
- Use the Notify key to trigger:
- An action,
- Another compound action, or
- A conversational process.
- Each of these runs in the context of the identified user, so the approval request relies on their Consented Auth if the User Consent Auth connector is used within the body used in the notify block.
4. Designing the Approval Message
- The simplest implementation is to send an initial message like: “You have a pending approval for X with the following details: Y. Please select an answer below.”
- Follow that with two interactive buttons that trigger actions:
- Approve → triggers an approval action.
- Deny → triggers a denial action.
- Alternatively you could also use a compound action or a conversational process for a more complex use case
Psuedo Code for the compound action
steps:
- action:
action_name: mw.get_user_by_email
output_key: approval_user
input_args:
user_email: data.approval_webhook.user_email
- notify:
output_key: notify_output
recipient_id: data.approval_user.user.id
message:
RENDER():
args:
approval_details: data.approval_webhook.details
template: |
You have a pending approval for {{approval_details}}. Please select a response below
actions:
- key: approve
label: '"Approve"'
system_action:
action_name: answer_approval_action_name
input_args:
answer: '"approve"'
approval_id: data.approval_webhook.approvalID
- key: deny
label: '"Deny"'
system_action:
action_name: answer_approval_action_name
input_args:
answer: '"deny"'
approval_id: data.approval_webhook.approvalID
Please let me know if I can offer any further context!