Forum Discussion

firstteam's avatar
firstteam
Copper Contributor
May 12, 2021

Is there any event for bot that I can use every time it is added?

OnConversationUpdateActivityAsync / OnTeamsMembersAddedAsync .. It looks like this event is only triggered very first time..which means, in order to invoke this event again, I need to register the bot with new ID every time to see that event...So this is kinda inconvenient in development stage...

 

Is there any event that is triggered every time when the bot is added(even under same id)? 

 

Thanks, 

 

14 Replies

  • firstteam's avatar
    firstteam
    Copper Contributor

    Here is something I found on Internet.

     

    --------------------------

    clearab commented on Jan 17, 2020 •
    A couple of things to add here:

    The conversationUpdate event is sent in slightly different instances depending on context:

    For a 1:1 conversation between the bot and a user (personal scope) the event is only sent the very first time the bot is installed. Technically, it is sent when the conversation is created between the bot and the user. If the user uninstalls the bot, this conversation is not deleted, so if the user then re-installs the bot the event is not sent.
    For Group Chats and Channels the event will be sent each time the bot is installed. This is because each time the bot is uninstalled from this context, it is actually completely removed from the conversation, so an uninstall triggers the event.
    An important distinction - the event is sent on a "best effort" basis. It is not 100% guaranteed to be sent, and is definitely not 100% guaranteed to be received. Outages and transient issues can affect the send (but they should be exceedingly rare).

    ---------------

     

    So If I understood correctly, it sounds like this guy is saying that if the bot was installed under Team Channel, that conversationUpdate event is triggered.

     

    Well..here is my manifest of my bot.

     

    "bots": [
    {
    "botId": ...,
    "scopes": [
    "team",
    "personal"
    ]
    }
    ],

     

    So my bot should support team and personal scope..so I tried to install my bot under team channel...and ..then reinstalled..however, conversationUpdate wasn't triggered. Somehow my understanding wasn't correct??

     

    Only thing I am able to see is that the conversationUpdate event is triggered ONLY the bot is fully registered again with new guid....

     

     

    • Mamatha-MSFT's avatar
      Mamatha-MSFT
      Former Employee

      Hi firstteam, The teamMemberAdded event is sent to your bot if the bot is added to a conversation first time . If you want to reinstall the app first uninstall the existing app from team then again install the app into a team then you will get teamMemberAdded event.

      • firstteam's avatar
        firstteam
        Copper Contributor
        Just FYI,..never mind...that event just started triggering again...I have no idea. Nothing changed. Not sure what made this work again...Who knows at some point it wouldn't trigger??..Anyway..just FYI.
  • firstteam's avatar
    firstteam
    Copper Contributor
    I noticed something like "OnInstallationUpdateActivityAsync" ..it sounds like this would trigger every time the bot is added...however, when I tried this, it wasn't triggered at all....hum.

Resources