0

In OnMessageActivityAsync, I am getting an API response, adding feedbackLoop to channelData and calling SendActivityAsync.

 var replyText = $" {APIresponse} ";
 var seperator = "------------------------------------";
 var disclaimerText = "```DisclaimerTextHere```";

 replyText = replyText + "\n\n" + seperator + "\n\n" + disclaimerText;

 var channelData = new JObject
 {
    { "feedbackLoop", new JObject { { "type", "default" } } }
 };

 var messageActivity = MessageFactory.Text(replyText);

 messageActivity.Type = ActivityTypes.Message;
 messageActivity.ChannelData = channelData;

 var resourceResponse = await turnContext.SendActivityAsync(messageActivity, 
 cancellationToken);
 _logger.LogInformation("Resource Response: {0}", resourceResponse.Id);

I am able to get the thumbsup/down icon and also collect the feedback for that message and log it to appinsights in OnInvokeActivityAsync.

 switch (turnContext.Activity.Name)
 {
   case "message/submitAction":
      
     _logger.LogInformation("Your feedback is " + 
     JObject.FromObject(turnContext.Activity.Value).ToString());
  
     _logger.LogInformation("Feedback for message ID: " + 
     turnContext.Activity.ReplyToId);

     var feedbackResponse = new
     {
         status = "success",
         message = "Feedback received"
     };
     return CreateInvokeResponse(200, feedbackResponse);

 default:

     return await base.OnInvokeActivityAsync(turnContext, cancellationToken);
}

I am now trying to link the feedback to the message for which the feedback is given. How can I do that? There is replyToId in OnInvokeActivityAsync and I have confirmed that it matches resourceResponse.Id in OnMessageActivityAsync. But how can I get the message or any attribute that corresponds to the replyToId.

The API response message also comes with an ID from the API endpoint(which I have access to). My ultimate goal is to match that ID that belongs to the incoming API response message to the feedback data and log to app insights. How can I achieve that?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.