How to Get CMD input after player press Enter key

I want to make a chat system.
and I use following code to setup a cmd message box.

ULocalPlayer* LocalPlayer = Cast(Player);

if (LocalPlayer != nullptr && LocalPlayer->ViewportClient->ViewportConsole != nullptr)
{
LocalPlayer->ViewportClient->ViewportConsole->StartTyping("Say ");
}

Dose any one know how to receive the typed string after player press Enter key

Ok,I found a way to do it. but not best way.
override the function like following:

virtual FString ConsoleCommand(const FString& Command, bool bWriteToLog = true) override;

I hope somebody can tell me the best way to do it.