As a trigger you could take advantage of tailgate state switches (open/ajar/closed) - at 17-pin connector in the roof by left D-pillar, pins 9 and/or 10 carry the status (-VE when tailgate open). However, as also the BCM monitors those switches (using PWM signal) some brainwork is definitely recommended before splicing into the circuit.