'Running clean up function on Google Workspace Add-on uninstall?

I'm working on a Google Workspace Add-on that functions within Gmail. It includes creating a filter and a label.

Is there a way to run a cleanup function if a user uninstalls it so that I can delete the filter and label before the Add-on is removed?

I can obviously add my own "uninstall" function that would do this, but if they remove the Add-on without running my uninstaller, I wouldn't want users to be left with these artifacts if the Add-on isn't available (it may affect their continuing Gmail use).

Thanks for any help...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source