botbuilder-community-dotnet icon indicating copy to clipboard operation
botbuilder-community-dotnet copied to clipboard

turnContext is not coming in MS Wrapper

Open Deepti886 opened this issue 3 years ago • 10 comments

Hi All,

As turnContext object is used to get the User details but we are unable to get the user's platform details in ServiceNow Controller of MS wrapper. Can someone provide any suggestion/solution to get the turnContext details in ServiceNow Controller in MS Wrapper.

Deepti886 avatar Jul 14 '21 07:07 Deepti886

@Deepti886 Have you checked Channel Data information

rvinothrajendran avatar Jul 14 '21 09:07 rvinothrajendran

Hi @rvinothrajendran , but I am not getting turnContext itself in the Controller, hence could not check channel data information. How Should I proceed then?

Deepti886 avatar Jul 14 '21 11:07 Deepti886

@Deepti886 why you want to handle in the controller ? explain your use case ?

rvinothrajendran avatar Jul 15 '21 07:07 rvinothrajendran

@rvinothrajendran I wanted to handle turnContext in the controller so that it can be used for exception logging if any exception occurs in controller. We wanted to log platform details of the user who has chatted as well while logging. Hence, it would be helpful if you could suggest some solution for this.

Deepti886 avatar Jul 16 '21 05:07 Deepti886

@Deepti886 turnContext has created by the Adapter if any error has occurred handle in the ex : AdapterWithErrorHandler.cs class If any exception has raised before calling "ProcessAsync" In this case you can handle like try { //throw new Exception("BotController Exception"); await Adapter.ProcessAsync(Request, Response, Bot); } catch (Exception) { var activity = await HttpHelper.ReadRequestAsync<Activity>(Request);

}

rvinothrajendran avatar Jul 16 '21 06:07 rvinothrajendran

@rvinothrajendran Thank you for your suggestion. Would like to also mention that we wanted to handle turnContext in the controller so that it can be used for logging of Chatscripts for the Users as well. We wanted to log platform details of the user who has chatted and in which platform he is chatting. Hence, it would be helpful if you could suggest some solution for this.

Deepti886 avatar Jul 22 '21 06:07 Deepti886

@rvinothrajendran Would like to follow up on the above ask. Please let me know if there is any update on the above ask?

Deepti886 avatar Jul 26 '21 04:07 Deepti886

@rvinothrajendran Would like to follow up to know if there is any update on the above ask?

Deepti886 avatar Jul 28 '21 08:07 Deepti886

@Deepti886 Have you checked var activity = await HttpHelper.ReadRequestAsync(Request); "activity" info ?

image

rvinothrajendran avatar Jul 30 '21 12:07 rvinothrajendran

@rvinothrajendran Did you mean to put and check var activity = await HttpHelper.ReadRequestAsync(Request); "activity" info in ServiceNowController.cs class of MS Wrapper solution or in the default BotController.cs class because we wanted to handle and need these details in the ServiceNowController.cs class?

Deepti886 avatar Jul 31 '21 06:07 Deepti886