我正在尝试使用 v4 bot 框架机器人(C# SDK)来启动与用户的 1:1 对话,并且我需要能够获取/创建对话 ID。我这样称呼:
var response = await m_client.Conversations.CreateDirectConversationAsync(new ChannelAccount(aadObjectId: "DB84C737-2161-4A35-B8C3-274B1FA4CF15", role: "bot"),
new ChannelAccount(role:"user",aadObjectId:"045AD4DB-133B-4C1B-870B-8201B7233625"));
// Construct the message to post to conversation
Activity newActivity = new Activity()
{
Text = "Hello",
Type = ActivityTypes.Message,
Conversation = new ConversationAccount
{
Id = response.Id
},
};
// Post the message to chat conversation with user
await m_client.Conversations.SendToConversationAsync(newActivity);
这是一个错误的请求。If I have a user message my bot first (or look for the ConversationUpdated event when they add the bot), I can save the conversation ID (something like a:1NJglnU1nkB-rqiCw2pQjbwMVViEYxyGxqGr8roBJMwtzzyDt_usg02D4HyaACgen_dOkikceYF3vdQ6kt6UAlxcT-tgCw7H8RWw46lLHBKYpxhkzgmMYJ9kOxiseAZga), but I want to be able to retrieve/为用户生成,而无需他们先向机器人发送消息,这就是我认为 CreateDirectConversationAsync 会给我的。
我还尝试为用户/机器人(地址@域)以及 aad 对象 ID 设置 ID 参数,但结果是相同的。有没有办法让我的机器人通过 SDK 为 1:1 聊天创建对话 ID?