Forum Discussion

voonsionglum's avatar
voonsionglum
Brass Contributor
Dec 07, 2020

onInstallationUpdate, onInstallationUpdateAdd and onInstallationUpdateRemove event handlers

Hi,

 

I'd like to know how the following methods are triggered:

onInstallationUpdate, onInstallationUpdateAdd, onInstallationUpdateRemove

We updated our botbuilder-core package to 4.11.0.  In our DialogBot class that extends ActivityHandler, we have added the following

 

this.onInstallationUpdateRemove(this._onInstallationUpdateRemove.bind(this))
this.onInstallationUpdateAdd(this._onInstallationUpdateAdd.bind(this))
this.onInstallationUpdate(this._onInstallationUpdate.bind(this))

 

 

All the event handlers do today is just to log that the event was triggered.  For example

 

console.log("__onInstallationUpdateRemove triggered");

 

I am assuming these events are triggered when a user installs or removes the app from his Teams instance.  However, when I tried to install or uninstall my bot from my Teams, nothing happens.  There are no "triggered" log statements.

 

Does anyone know how these events get triggered?  What is their purpose?

 

Thank You

  •  Your code does something else that it should.. the binding there is not allowed.

    You would do either

     

    this.onInstallationUpdate(this.botHandler1);
    this.onInstallationUpdateAdd(this.botHandler1);
    this.onInstallationUpdateRemove(this.botHandler1); 
    
    private botHandler1 = async (context: TurnContext, next: () => Promise<void>): Promise<any> => {
      console.log('what happened? ', context.activity.name); 
      await next();
    }; 

     

    Or either override activity methods like:protected onInstallationUpdateAddActivity(context: TurnContext): Promise<void> { console.log('on installation add activity ', context.activity); return super.onInstallationUpdateAddActivity(context); } 

     

     

    override onInstallationUpdateAddActivity(context: TurnContext): Promise<void> {
        console.log('on installation add activity ', context.activity);
        return super.onInstallationUpdateAddActivity(context);
      }

     

     

    Hope this will solve your issue 2 years after you've dealt with it 🙂 

     

     

     

Resources