Sending messages in Teams with a bot on behalf of a user

筅森魡賤 提交于 2020-01-25 09:28:06

问题


I have an app containing a bot on Microsoft Teams, built using the bot-framework. I need my application to be able to let users send message to a specific channel and thread. I can do this with my bot using the "proactive messaging" ability, but the message is then send by the bot, not the user. Is there any way to achieve this as if the user sent the message?


回答1:


You don't need to use the bot.

Just try this Microsoft Graph API endpoint (beta version):

POST https://graph.microsoft.com/beta/teams/TEAM_ID/channels/CHANNEL_ID/chatThreads
{
 "RootMessage": {
    "body": {
       "contentType": 1,
       "content": "Hello World!"
      }
  }
}

Remember that you need to implement the Authentication on behalf of a user.



来源:https://stackoverflow.com/questions/58602926/sending-messages-in-teams-with-a-bot-on-behalf-of-a-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!