On PC you do it through the console, which you open with the tilde key.
Type set input, then the key you want to use, then say and the message itself. Press Enter, close the console with the tilde again, and from then on tapping that key drops the line into chat. It is the standard Unreal Engine binding syntax, so the same approach works for other commands if you want to set up more than one.