I assume you are referring to the Trailer Hitch Cap P/N 19421060 sold by the GM parts department which is manufactured by Curt. I just got done installing one on my 2022 Sierra 1500 Limited with the Multipro tailgate. It works good. It is a spring loaded cover for the 2" receiver that is hinged at the top and has a snap latch to hold it down on the bottom edge. Whenever the cover is up, the circuit to release the upper section of the tailgate is interrupted, preventing it from crashing into the trailer hitch. The sensor appears to be a magnet and a reed switch.
The entire harness is plug and play. My only complaint is that the kit did not provide any provisions to anchor the extra connectors. I did not want them flipping around endlessly leading to fractured wires, so I made small brackets and used cable ties.