old_contents: 'use strict';
  
  const _ = require('underscore');
  
  function buildSlots(slots) {
    const res = {};
    _.each(slots, (value, key) => {
      if ( _.isString(value)) {
        res[key] = {
          name: key,
          value: value
        };
      } else {
        res[key] = {
          name: key,
          ...value
        };
      }
    });
    return res;
  }
  
  function buildSession(e) {
    return e ? e.sessionAttributes : {};
  }
  
  function init(options) {
    let isNew = true;
  
    // public API
  
    const api = {
      init,
      build
    };
  
    function build(intentName, slots, prevEvent) {
      if (!options.appId) throw String('AppId not specified. Please run events.init(appId) before building a Request');
      const res = { // override more stuff later as we need
        session: {
          sessionId: options.sessionId,
          application: {
            applicationId: options.appId
          },
          attributes: buildSession(prevEvent),
          user: {
            userId: options.userId,
            accessToken: options.accessToken
          },
          new: isNew
        },
        request: {
          type: 'IntentRequest',
          requestId: options.requestId,
          locale: options.locale,
          timestamp: (new Date()).toISOString(),
          intent: {
            name: intentName,
            slots: buildSlots(slots)
          }
        },
        version: '1.0'
      };
      isNew = false;
      return res;
    }
  
    return api;
  }
  
  module.exports = {init};
  
new_contents: 'use strict';
  
  const _ = require('underscore');
  
  function buildSlots(slots) {
    const res = {};
    _.each(slots, (value, key) => {
      if ( _.isString(value)) {
        res[key] = {
          name: key,
          value: value
        };
      } else {
        res[key] = {
          ...value,
          name: key
        };
      }
    });
    return res;
  }
  
  function buildSession(e) {
    return e ? e.sessionAttributes : {};
  }
  
  function init(options) {
    let isNew = true;
  
    // public API
  
    const api = {
      init,
      build
    };
  
    function build(intentName, slots, prevEvent) {
      if (!options.appId) throw String('AppId not specified. Please run events.init(appId) before building a Request');
      const res = { // override more stuff later as we need
        session: {
          sessionId: options.sessionId,
          application: {
            applicationId: options.appId
          },
          attributes: buildSession(prevEvent),
          user: {
            userId: options.userId,
            accessToken: options.accessToken
          },
          new: isNew
        },
        request: {
          type: 'IntentRequest',
          requestId: options.requestId,
          locale: options.locale,
          timestamp: (new Date()).toISOString(),
          intent: {
            name: intentName,
            slots: buildSlots(slots)
          }
        },
        version: '1.0'
      };
      isNew = false;
      return res;
    }
  
    return api;
  }
  
  module.exports = {init};
  
subject: Make sure to keep the property 'name'