Tabnine Logo For Javascript
ask-sdk-model
Code IndexAdd Tabnine to your IDE (free)

How to use ask-sdk-model

Best JavaScript code snippets using ask-sdk-model(Showing top 2 results out of 315)

origin: SAPConversationalAI/bot-connector

async parseIncomingMessage (conversation, message, opts) {
  try {
   // Workaround for passing on the Response Builder since the ASK SDK wraps it into an object
   // eslint-disable-next-line max-len
   // https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/blob/2.0.x/ask-sdk-core/lib/skill/Skill.ts#L93
   const alexaResponse = await AmazonAlexa.skill.invoke(message)

   // Extract msg (for Bot Builder) and responseBuilder (for Alexa response)
   const { response: { msg, responseBuilder } } = alexaResponse
   // Delete the current response object
   delete alexaResponse.response
   _.set(opts, 'responseBuilder', responseBuilder)
   _.set(opts, 'alexaResponseTemplate', alexaResponse)
   return msg
  } catch (err) {
   logger.error(`[Amazon Alexa] Error invoking skill: ${err}`)
   throw err
  }
 }
origin: alexa/skill-sample-nodejs-zero-to-hero

handle(handlerInput) {
    const {attributesManager, requestEnvelope} = handlerInput;
    // the attributes manager allows us to access session attributes
    const sessionAttributes = attributesManager.getSessionAttributes();
    const {intent} = requestEnvelope.request;

    if (intent.confirmationStatus === 'CONFIRMED') {
      const day = Alexa.getSlotValue(requestEnvelope, 'day');
      const year = Alexa.getSlotValue(requestEnvelope, 'year');
      // we get the slot instead of the value directly as we also want to fetch the id
      const monthSlot = Alexa.getSlot(requestEnvelope, 'month');
      const monthName = monthSlot.value;
      const month = monthSlot.resolutions.resolutionsPerAuthority[0].values[0].value.id; //MM

      sessionAttributes['day'] = day;
      sessionAttributes['month'] = month; //MM
      sessionAttributes['monthName'] = monthName;
      sessionAttributes['year'] = year;
      // we can't use intent chaining because the target intent is not dialog based
      return SayBirthdayIntentHandler.handle(handlerInput);
    }

    return handlerInput.responseBuilder
      .speak(handlerInput.t('REJECTED_MSG'))
      .reprompt(handlerInput.t('REPROMPT_MSG'))
      .getResponse();
  }
ask-sdk-model(npm)

Most used ask-sdk-model functions

  • Resolutions.resolutionsPerAuthority
  • ResponseEnvelope.response
  • Slot.resolutions
  • Slot.value
  • Value.id

Popular in JavaScript

  • semver
    The semantic version parser used by npm.
  • aws-sdk
    AWS SDK for JavaScript
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • debug
    small debugging utility
  • colors
    get colors in your node.js console
  • postcss
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • lodash
    Lodash modular utilities.
  • commander
    the complete solution for node.js command-line programs
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now