Door sensor and audio recorder pairing possible?

Hello

My question is, if it is possible to maybe pair a audio recorder to a door sensor?

The idea is that I would like to place a audio recorder above the main door, and start recording when a door sensor is triggers and stop again if closed. And maybe being able to upload to an ftp server.

My reason it that I after some years living in the ghetto and experienced many treats and harassment from trouble youth, that I want to be more prepared. I have had the income now to move, but I like to be more prepared in the future if I should experience similar issues.

Thanks for your help and understanding.