Please add functionality to open TaskPane dynamically in Outlook web add-ins from these supported events Configure your Outlook add-in for event-based activation - Office Add-ins | Microsoft Learn.
I would suggest implementing one of the following - Office.context.ui.openContainer() or Office.addin.showAsTaskpane() (doesn't work in Outlook)