Issue with Member_2 and Member along with the sendMessage function - Ticket #11694

I am currently facing significant challenges when it comes to optimizing a notification bot created with Teams Toolkit.

One of the main issues I'm encountering is related to the following code snippet:

const member = await notificationApp.notification.findMember( async (m) => m.account.email === email );

This particular operation is taking too long to execute. Even with just 50 members, it is taking around 1 minute to complete, resulting in almost an hour to send 50 individual messages.

To address this problem, I decided to implement a Redis service on Azure and store user data in Redis to reduce the time required to retrieve user information. However, I am struggling to construct the Member object based on the data saved in Redis. Since Redis only supports JSON storage, I stored whatever information I could extract and attempted to create a Member class instance using its constructor. Here is my current approach:

let memberFromRedis = await getMemberFromRedis(email); const account = memberFromRedis["account"] as TeamsChannelAccount; 
const conversationReference = memberFromRedis["parent"]["conversationReference"]; 
const teamsBotInstallation = await notificationApp.notification.buildTeamsBotInstallation(conversationReference); 
// @ts-ignore const user = new Member(teamsBotInstallation , account);

The reason for using ts-ignore is due to encountering an unusual type error that states:

Argument type 'TeamsBotInstallation_2' is not assignable to parameter type 'TeamsBotInstallation'. Property types are not compatible - 'CloudAdapter' properties are missing several key properties found in 'BotFrameworkAdapter': TokenApiClientCredentialKey, credentials, credentialsProvider, settings, and 41 others.

However, upon reviewing the types used, TeamsBotInstallation_2 is explicitly declared as equivalent to TeamsBotInstallation. So, they should theoretically be of the same type, right?

Despite this observation, I continue to encounter errors while attempting to call the await user.sendMessage("test"); function, which results in the following error message:

{ "code": "Internal", "message": "Error: CloudAdapterBase.continueConversationis deprecated, please use CloudAdapterBase.continueConversationAsync" } 

It appears that there are discrepancies between the expected Member class and the actual return type from the findMember(Member_2) method, even though both types are supposedly defined as identical according to the exported types seen in codebase.

During debugging, a subtle difference was noted:here

The functions, such as sendAdaptiveCard, seem to reference different locations and exhibit varying object types.

Could this discrepancy be the root cause of the issue? If so, how can I effectively resolve it?

I have explored various methods such as creating the Member object directly from its constructor, parsing with JSON, and utilizing 'as Member', but unfortunately, none of these approaches have yielded success.

Answer №1

A similar question has been addressed in the Teams Toolkit GitHub Discussion.

Within TeamsFx SDK, there are two distinct types of Member:

  1. (conversation) Member
  2. (conversationWithCloudAdapter) Member

The former is considered deprecated due to the deprecation of its property (conversation) TeamsBotInstallation. It is recommended to utilize the new type with the same name (conversationWithCloudAdapter) TeamsBotInstallation.

An error in your code stems from returning the type (conversationWithCloudAdapter) TeamsBotInstallation by buildTeamsBotInstallation, while the constructor of (conversation) Member necessitates the type of (conversation) TeamsBotInstallation

To address this issue, consider examining the sample app for Large Scale Notification Bot if you have concerns regarding notification performance.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Why does my jQuery code target all the text values?

Looking to grab a specific table cell number and multiply it by an input value on focusout, but having trouble with the selector grabbing all cells with "front" in the name. Check out the code below: jquery $(document).ready(function(){ $(".percent") ...

Creating a texture from an iframe in three.js

Is it possible to dynamically assign an iFrame as a texture onto an obj model? I know that it can be done with videos. I found this example interesting - where an iFrame is loaded into a three.js environment: And also this example, which demonstrates map ...

Determining the duration since generating a unique objectid in mongodb

I am currently developing an application that offers users the option to reset their passwords. The process is quite straightforward - after entering his email address, the user will receive a link containing the new objectid number. For example: /reset- ...

Ajax updates previous text to new text upon successfully completing the task

I have a question regarding changing text using AJAX after success. I have written this AJAX code which is functioning properly. However, I aim to replace the old text with new text in the .chnged div. For instance: <input type="text" name="text" va ...

The IBMCloudCodeHybrid SDK continuously encounters onFailure errors on Android devices

Currently, I'm in the process of developing a mobile application using BlueMix's hybrid technology. Recently, I completed the setup by installing the necessary tools as guided here. Within the Server Node.js code (ensuring dependencies and ibmco ...

Maintain the dropdown selection while the table is being updated

My table updates every few seconds and each row has a dropdown menu that allows users to take actions on that row. However, the problem is that when new data is received from the database, the dropdown menu closes if it was open. This can be frustrating f ...

The issue with 'DemoCtrl' defined in Angular JS is that it does not correspond to a valid argument

signup.html <div ng-controller="UniqueCtrl" layout="column" ng-cloak="" class="md-inline-form inputdemoBasicUsage" ng-app="inputBasicDemo"> <md-content md-theme="docs-dark" layout-gt-sm="row" layout-padding=""> <div> <md- ...

What is the best way to display an image path and add it to the Ajax success function in a CodeIgniter application?

I am struggling to display my image path correctly using append and a variable to store the value. However, whenever I try, it results in an error. Let me provide you with the code snippet: <script type="text/javascript"> $(document).ready(funct ...

The shopping list feature is unable to save or list multiple recipes at once

My goal is to: Create a shopping list that retrieves recipes from an API. Transfer ingredients from one page to another. Automatically refresh/load data when more than 1 item is added. The challenge I am facing is: Only one set of ingredients loads. T ...

Assign a class to each element that the mouse hovers over while simultaneously clicking the mouse

I am faced with a scenario where I have three boxes: div { display: inline-block; width: 100px; height: 100px; border: 1px solid black; cursor: pointer; } div.selected, div:hover { background-color: red; color: white; } <div>A</d ...

Choose a Date from the Calendar and Modify the Link Text

I have a Link Label on my page that triggers a calendar pop-up when clicked. I want the label to update to the selected date in the format '30 JAN 2017' from the calendar. The issue lies with the local variable var dateText =...; although the la ...

I am facing an issue where my Javascript hide and show function is not working properly when clicked. Despite not giving

I am currently working on a Javascript onClick function to toggle the visibility of content in a lengthy table. I initially set part of the table's class to display: "none" and added a button to show the hidden content when clicked. However, nothing i ...

Enhancing visual appearance with customized look control through the use of setAttribute

I have developed a unique custom look-controls feature and I am trying to integrate it into the scene using 'setAttribute(componentName, data)', but I'm unsure about what parameters to include. Any suggestions? Here is my approach: const s ...

Guide to triggering an API call upon changing the value in a Vue Multiselect component

Is there a way to trigger an API call when the value changes in a Vue Multiselect component? I want to update the value in the multiselect, make an API call, and display the result in the console. Below is my code snippet. <template> <div> ...

React Functional Component fails to update on state changes

I'm in the process of creating a React application where I can input my height and weight to calculate my BMI. The goal is to display the BMI value on a diagram. To keep things organized, I decided to break down the functionality into smaller componen ...

Testing a default export class method with Jest in Typescript

Scenario: I have a custom hook that relies on @react-native-firebase/dynamic-links for testing. We are using @testing-library and its utilities for react-native to test hooks (@testing-library/react-hooks). Below is the simplified example of the hook I w ...

Label Overlapping Issue in React Select

Utilizing react-select version ^5.1.0, I am encountering an issue where the word "select" overlaps with the options when scrolling. An image has been attached for better clarification. How can I eliminate the occurrence of the select word overlapping my op ...

Utilize React to showcase all stored items in localStorage in a Material UI List

I have a storage system with multiple items stored in it. I am looking to retrieve all of them and showcase them using a <ListItem> from Material UI. This is my current code snippet: function saveItem(key, value) { localStorage.setItem(key, value) ...

Vue-based bot for telegram web application

Hey there, I've been working on integrating a web app with my chat bot, taking advantage of the new Telegram feature. Unfortunately, after adding the site, I'm encountering an issue where clicking the button opens up an empty page. It seems that ...

Angular: Implementing default nested routes

I am currently facing a challenge with routing in my Angular application. I have set up a page within a router-output on the route /products. This page contains another router-output which will display one of two possible children routes (/products/profess ...