I used a switch with a modified SimpliSafe Entryway sensor to install an external gate alarm. Works perfectly! I installed the same setting in my USPS mailbox to receive email delivery notifications.
Pros
3 in. (76 mm) spacing, 36 in. (91 cm) wires sheathed in armored cable