You'd need to look into what you need to do to turn the mic on and off, but if it's just a keypress then yes - you could make Puck.js appear as a keyboard with http://www.espruino.com/BLE+Keyboard and could then just 'press' the key.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
You'd need to look into what you need to do to turn the mic on and off, but if it's just a keypress then yes - you could make Puck.js appear as a keyboard with http://www.espruino.com/BLE+Keyboard and could then just 'press' the key.