Uninstallation Handler

The uninstallation handler is triggered once the extension is uninstalled successfully. The following parameters are passed when an uninstallation handler is triggered.

AttributeDescription
userDetails of the user who is installing the extension.
app_info

 Details of the extension being installed.

{"current_version":"1.5", "type": "install"}

Details of the extension being upgraded.

{"current_version":"1.5","existing_version":"1.3","type":"upgrade"}

User Scenario

Let us consider an extension integrating GitLab and Cliq. The webhooks created during installation can be deleted using the uninstallation handler. This handler does an entire clean up once the extension is uninstalled, thereby ensuring the privacy and security  of your extension data. The sample code snippet is given below. 


getProjects = invokeurl
[
	url :"https://gitlab.com/api/v4/projects?visibility=private&simple=true"
	type :GET
	connection:"ENTER THE CONNECTION NAME"
];
for each  project in getProjects
{
	projectID = project.get("id");
	webhooks = invokeurl
	[
		url :"https://gitlab.com/api/v4/projects/" + projectID + "/hooks"
		type :GET
		connection:"ENTER THE CONNECTION NAME"
	];
	for each  webhook in webhooks
	{
		if(webhook.get("url").contains("https://cliq.zoho.com/api/v2/applications/"APP-ID"/incoming"))
		{
			deleteWebhookId = webhook.get("id");
			deleteWebhook = invokeurl
			[
				url :"https://gitlab.com/api/v4/projects/" + projectID + "/hooks/" + deleteWebhookId
				type :DELETE
				connection:"ENTER THE CONNECTION NAME"
			];
		}
	}
}