Teams Toolkit 机器人 - 存储问题

问题描述 投票:0回答:1

我当前将用户的对话引用对象存储在 Blob 存储中,但在机器人更新后,它似乎无论如何都会丢失用户的上下文,并且我无法向该对话对象发送消息。

我尝试向对话对象发送消息,甚至一度向整个成员对象发送消息,因为机器人似乎就是以通知为目标的。这是我相关部分的代码

   try{
    const storedTarget = await storage.get(payload.memberId);
    if(!storedTarget){
      return res.send(404, "Member not found");
    }
    const conversationReference = storedTarget as ConversationReference;
    //continue conversaton
    await notificationApp.adapter.continueConversationAsync(
      'bot_id_number_here', 
      conversationReference,
      async (context) => {
        await context.sendActivity({
          type: 'message',
          text: 'Hello, This is a Test!'
        })
      }
    )
    res.send(200, "Success");
  } catch (error) {
    console.error("Error:", error);
    console.log("Member cannot receive card", target)
  }
microsoft-teams teams-toolkit
1个回答
0
投票

机器人更新后机器人ID是否发生变化?如果是这样,您需要使用原始的机器人 ID,否则现有的对话引用对于新的机器人 ID 无效。

© www.soinside.com 2019 - 2024. All rights reserved.