Proactive messaging bot in Teams without mentioning the bot beforehand

后端 未结 2 1998
旧时难觅i
旧时难觅i 2020-11-30 15:34

I\'m using the Microsoft bot-framework to create a bot and integrate it into teams. Part of the bot\'s requirements include proactively messaging users once per day. From wh

2条回答
  •  死守一世寂寞
    2020-11-30 16:12

    EDIT: The Graph API you've referenced is only necessary if you wish to proactively message a user who is not in a channel/groupChat where the bot is installed. If you need to proactively message only people who are in context where the bot is installed already, the answer from mdrichardson is the easiest possible method.

    We've identified a couple of issues with the Graph API beta endpoint you referenced that should be fixed in the near term. In the meantime workarounds are as follows:

    Calling:

    POST https://graph.microsoft.com/beta/me/teamwork/installedApps/
      {"teamsapp@odata.bind":"https://graph.microsoft.com/beta/appcatalogs/teamsapps/APP-GUID"} 
    
    • Will install an app in the personal scope of a user.
    • Known issue: Currently, if the app contains a bot, then installation will not lead to creation of thread between the bot and the user. However to ensure that any missing chat threads, get created, call:

      GET https://graph.microsoft.com/beta/me/chats?$filter=installedApps/any(x:x/teamsApp/id eq 'APP-GUID')

    Calling:

    GET https://graph.microsoft.com/beta/me/chats?$filter=installedApps/any(x:x/teamsApp/id eq 'APP-GUID')
    
    • Gets the chat between a user and an app containing a bot.
    • Known issue: Calling this API will lead to sending a conversation update event to the bot even though there were no updates to the conversation. Your bot will essentially get two install events and you'll need to make sure you don't send the welcome message twice.

    We'll also be adding more detailed documentation for the proactive messaging flow using these Graph APIs

提交回复
热议问题