在微软的世界里,Webex中简单的东西现在看起来相当复杂。 我特别希望做的是:
这是我到目前为止一直在使用的 https://pypi.org/project/botframework-connector/
from botbuilder.schema import *
from botframework.connector import ConnectorClient
from botframework.connector.auth import MicrosoftAppCredentials
APP_ID = 'azure_bot_app_id'
APP_PASSWORD = 'azure_bot_app_password'
SERVICE_URL = 'azure_bot_messaging_endpoint'
CHANNEL_ID = 'msteams'
BOT_ID = 'azure_bot_subscription_id'
RECIPIENT_ID = 'msteams_individual_user_id'
credentials = MicrosoftAppCredentials(APP_ID, APP_PASSWORD)
connector = ConnectorClient(credentials, base_url=SERVICE_URL)
conversation = connector.conversations.create_conversation(ConversationParameters(
bot=ChannelAccount(id=BOT_ID),
members=[ChannelAccount(id=RECIPIENT_ID)]))
connector.conversations.send_to_conversation(conversation.id, Activity(
type=ActivityTypes.message,
channel_id=CHANNEL_ID,
recipient=ChannelAccount(id=RECIPIENT_ID),
from_property=ChannelAccount(id=BOT_ID),
text='Hello Person!'))
这是否接近正确的方法
这是我找到的最简单的方法
很容易推断出所有大写变量
<<RECIPIENT_ID>>
是要发送消息的用户的MS团队ID希望这有帮助
MSFT在Python中没有提供好的示例
粗略地看一下,它看起来还可以(我不使用Python,因此无法实际运行该示例)。在TrustServiceUrl调用中,确实缺少一件事。详情见here
相关问题 更多 >
编程相关推荐