Searching online, I see many (like me) have wanted to do this, but there are issues. The older versions of Unreal it just doesn’t work, apparently, but the later versions, I got it to mostly work by searching online, through this Blender Character course, and trial-and-error. This is (almost) imperative for making a humanoid character for Unreal to be put on the marketplace, and for using existing Unreal Mannequin animations on your character.
Warning: 11 pages, it’s not simple! (edit: changed to UE4 Wiki version, which is updated some)
I am using Unreal Engine version 4.18, should be similar in recent engine versions. Using Blender 2.79, again should work in recent Blender versions.