delete.js
delete.js
is configuration of JavaScript logic when trigger is deleted.
It will be executed when user deletes a webhook for subscription/automation.
With input
variable, user can create their own logic for trigger.
You need to put a connector api call logic to delete an existing webhook trigger.
Expected input/output
- Execution input
- trigger_create_output
- stored output of trigger create.js
- subscription_id
- user id
- matched_subscription_count
- trigger variables
- trigger_create_output
- Execution output
- output result is not specified
Example delete.js
try {
if(parseInt(input.matched_subscription_count) === 1) {
const response = await $.axios({
method: "delete",
url: `https://graph.microsoft.com/v1.0/subscriptions/${input.subscription_id}`,
headers: {
"Authorization": `Bearer ${serivce.token}`,
"Content-Type": "application/json"
}
})
return ""
} else {
return ""
}
} catch (error) {
throw error
}
Helpful?