Martin Dimitrov 4cad1fbe2b
All checks were successful
Build and push Doorman UI / API / docker (push) Successful in 1m27s
discord notifications
2024-10-26 13:31:15 -07:00

18 lines
658 B
JavaScript

/**
* Automatically open the door
*/
exports.handler = function(context, event, callback) {
let twiml = new Twilio.twiml.VoiceResponse();
let config = JSON.parse(event.config);
let configQuery = `config=${encodeURIComponent(JSON.stringify(config))}`;
let passAlong = `fingerprint=${encodeURIComponent(event.fingerprint)}&${configQuery}`;
twiml.play('https://buzzer-2439-prod.twil.io/buzzing_up_boosted.mp3');
twiml.play({ digits: config.pressKey }); // configured in doorman what button to click and passed into this function
twiml.pause({ length: 1 });
twiml.redirect(`/text-me?Method=doorman&${passAlong}`);
callback(null, twiml);
};