Skip to main content
Version: 6.1.0

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 service 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
  • 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 ${service.token}`,
"Content-Type": "application/json"
}
})

return ""
} else {
return ""
}


} catch (error) {
throw error
}