How to get Activity Info from an IDialogContext
Asked Answered
R

1

8

I'm using a LuisDialog and all I get the the callback returns is an IDialogContext and the LuisResult. Is there a way I can get info from the original Activity, like channel, from name, et al?

Retinite answered 7/9, 2016 at 15:55 Comment(0)
U
11

Since the v3.2.0 release you can access the original incoming message from the intent handlers. Check here to understand how your intent handler should looks like.

public async Task MyHandler(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)

Alternatively, you can use context.MakeMessage but I would recommend updating your intent handlers.

Uglify answered 7/9, 2016 at 17:45 Comment(5)
thanks, BTW with context.MakeMessage you can't get the text from the original Activity, so I guess upgrading is a must :)Retinite
Correct. If you need the original text, you must go with the newest intent handler signature.Uglify
When I use this in my intent, It shows an exception with intent name in exception message "none". I think it means it could not find the none intent with same signature.Blimp
Do you have to change the syntax of your messagescontroller in order to get it to work? I don't know how to do it. Help!!!Blimp
Have you updated the version of the BotBuilder nuget package? Do you have a none intent both in the code and in Luis?Uglify

© 2022 - 2024 — McMap. All rights reserved.