Skip to content

[Dev support]: Custom feedback loops in .NET #2387

Description

@JGemkow

Question

I'm observing two issues with custom feedback loops when using the library within my .NET project.

  1. Setting feedbackLoopType to "custom" on a StreamingChannelData object included as ChannelData in a message Activity response from the bot does not properly enable Teams to be able to fetch a custom feedback form when clicking the feedback buttons.

    This appears to be related to an issue with how the feedbackLoopType is serialized to the channelData property within the JSON. Currently, feedbackLoopType is included as a property of channelData when serialized. However, according to some docs, the bot framework API seems to expect this to be set like the following within the channelData property:

    {
        "feedbackLoop": {
            "type": "custom"
        }
    }
    

    Please see the code snippet below, should this be expected?

  2. I'm running into an error when responding to message/fetchTask invoke requests. The network trace in Teams shows the following error in the HTTP response from the invoke: {"errorCode":1008,"message":"<BotError>Error when processing invoke response: Task or Task Type is missing in Task Module response","standardizedError":{"errorCode":1008,"errorSubCode":1,"errorDescription":"<BotError>Error when processing invoke response: Task or Task Type is missing in Task Module response"}}. No exception is raised within the Teams AI library when responding. Example of the the handler is below. Adaptive Card included in the attachment has been validated in the Adaptive Card designer, and I did try swapping out a 'known working' card from another task module - same result. Anything I'm missing?

Code snippets

  1. Working example using TeamsChannelData instead of StreamingChannelData:

    {
        AdditionalProperties = new Dictionary<string, object>()
        {
            ["streamSequence"] = 2,
            ["streamType"] = "final",
            ["feedbackLoop"] = new Dictionary<string, object>
            {
                { "type", "custom" }
            }
        }
    };
    
    await turnContext.SendActivityAsync(activity, cancel);
    

    Expected to work, but not working:

    {
        StreamSequence = 2,
        StreamType = StreamType.Final,
        feedbackLoopType = "custom"
    };
    
    await turnContext.SendActivityAsync(activity, cancel);
    
  2. Example of the message handler for OnFetchFeedbackForm

    public async Task<MessageFetchTaskResponse> OnFetchFeedbackForm(ITurnContext turnContext, AppState turnState, object data, CancellationToken cancel)
    {
        var cardContent = await ReponseExtensions.GenerateFeedbackAdaptiveCardAsync(cancel);
    
        return new MessageFetchTaskResponse
        {
            TaskInfo =
            new TaskModuleTaskInfo()
            {
                Height = 500,
                Width = 600,
                Title = "Feedback",
                Card = new Attachment
                {
                    ContentType = AdaptiveCard.ContentType,
                    Content = AdaptiveCard.FromJson(cardContent).Card
                }
        
            }
        
        };
    }
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions