Alexa, ask Wezmondo to grind 2 cups of coffee, please...

Turn your Alexa off before watching this one!

const GrindIntentHandler = {
    canHandle(handlerInput) {
        return handlerInput.requestEnvelope.request.type === 'IntentRequest'
            && handlerInput.requestEnvelope.request.intent.name === 'grindcoffee';
    },
    handle(handlerInput) {
        const cups = handlerInput.requestEnvelope.request.intent.slots['Cups'].value;
        const grinding = grindCoffee(cups);
        const speechText = 'Grinding ' + cups + " cups of coffee";
        return handlerInput.responseBuilder
            .speak(speechText)
            //.reprompt('add a reprompt if you want to keep the session open for the user to respond')
            .getResponse();
    }
};
function grindCoffee(count)
{
     
       return new Promise(((resolve, reject) => {
    var options = {
        host: 'server.net',
        port: 443,
        path: '/path?grinder=grind,' + count,
        method: 'GET',
    };
    
    const request = https.request(options, (response) => {
      response.setEncoding('utf8');
      let returnData = '';

      response.on('data', (chunk) => {
        returnData += chunk;
      });

      response.on('end', () => {
        //resolve(JSON.parse(returnData));
      });

      response.on('error', (error) => {
        reject(error);
      });
    });
    request.end();
  }));
    

}