Switch input and fix message?

Hello :slight_smile: !

Is there a posibility to connect a switch and send a canned message wenn the switch is closed like an rotary button, but only with one fix message?
I mean switch closed - Message “Door closed” (GPIO2-TBeam)

Or do you know were i can change it in the code?

Br
Arnold