Git Product home page Git Product logo

skill-sample-nodejs-calendar-reader's Introduction

Build An Alexa Calendar Reader Skill

Voice User InterfaceLambda FunctionConnect VUI to CodeTestingCustomizationPublication

This Alexa sample skill is a template for a basic calendar reader skill. Provided a calendar is plugged in, Alexa will provide details of upcoming events and scheduled activities.

If this is your first time here, you're new to Alexa Skills Development, or you're looking for more detailed instructions, click the Get Started button below:

Be sure to take a look at the Additional Resources at the bottom of this page!

About

Note: The rest of this readme assumes you have your developer environment ready to go and that you have some familiarity with CLI (Command Line Interface) Tools, AWS, and the ASK Developer Portal. If not, click here for a more detailed walkthrough.

Usage

Alexa, ask events calendar how many events I have today.
	>> "Sorry there aren't any events scheduled. Would you like to search again?

Alexa, open events calendar

Repository Contents

Setup w/ ASK CLI

Pre-requisites

Installation

  1. Clone the repository.

    $ git clone https://github.com/alexa/skill-sample-nodejs-calendar-reader/
  2. Initiatialize the ASK CLI by Navigating into the repository and running npm command: ask init. Follow the prompts.

    $ cd skill-sample-nodejs-calendar-reader
    $ ask init
  3. Install npm dependencies by navigating into the /lambda/custom directory and running the npm command: npm install

    $ cd lambda/custom
    $ npm install

Deployment

ASK CLI will create the skill and the lambda function for you. The Lambda function will be created in us-east-1 (Northern Virginia) by default.

  1. Deploy the skill and the lambda function in one step by running the following command:

    $ ask deploy

Testing

  1. To test, you need to login to Alexa Developer Console, and enable the "Test" switch on your skill from the "Test" Tab.

  2. Simulate verbal interaction with your skill through the command line using the following example:

     $ ask simulate -l en-US -t "start events calendar"
    
     ✓ Simulation created for simulation id: 4a7a9ed8-94b2-40c0-b3bd-fb63d9887fa7
    ◡ Waiting for simulation response{
      "status": "SUCCESSFUL",
      ...
  3. Once the "Test" switch is enabled, your skill can be tested on devices associated with the developer account as well. Speak to Alexa from any enabled device, from your browser at echosim.io, or through your Amazon Mobile App and say :

    Alexa, start events calendar
    

Customization

  1. ./skill.json

    Change the skill name, example phrase, icons, testing instructions etc ...

    Remember that many information is locale-specific and must be changed for each locale (en-GB and en-US)

    See the Skill Manifest Documentation for more information.

  2. ./lambda/custom/index.js

    Modify messages, and facts from the source code to customize the skill.

  3. ./models/*.json

    Change the model definition to replace the invocation name and the sample phrase for each intent. Repeat the operation for each locale you are planning to support.

Additional Resources

Community

Tutorials & Guides

  • Voice Design Guide - A great resource for learning conversational and voice user interface design.
  • CodeAcademy: Learn Alexa - Learn how to build an Alexa Skill from within your browser with this beginner friendly tutorial on CodeAcademy!

Documentation

skill-sample-nodejs-calendar-reader's People

Contributors

akersh-s avatar ddrager avatar ggirou avatar jakemkelly avatar jeffblankenburg avatar paulstubbs avatar rickwargo avatar ysak-y avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skill-sample-nodejs-calendar-reader's Issues

Events NOT registering (!!!)

I have successfully edited and fixed my code, but my calendar isn't reading in the skill. I keep getting the "no events scheduled" type message, even when I KNOW there is one. :( What's going on??

I am using a webcal://url.

relevantEvents is always blank

Hi,

I'm having a hard-time getting relevantEvents to work for eventIntent. I believe the relevantEvents is not getting saved and hence, every time the lambda function executes, it's blank.

Lambda function errors out

I'm following the tutorial and I'm having trouble in the testing section. The lambda function errors out. Here's the log output:

START RequestId: 2fbcfe89-d08d-11e6-a91d-4fb848ee7914 Version: $LATEST
2017-01-02T01:45:50.007Z	2fbcfe89-d08d-11e6-a91d-4fb848ee7914	TypeError: Cannot read property 'locale' of undefined
    at AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:102:38)
    at AlexaRequestEmitter.Object.defineProperty.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:91:31)
    at exports.handler (/var/task/index.js:267:11)
END RequestId: 2fbcfe89-d08d-11e6-a91d-4fb848ee7914
REPORT RequestId: 2fbcfe89-d08d-11e6-a91d-4fb848ee7914	Duration: 120.75 ms	Billed Duration: 200 ms 	Memory Size: 128 MB	Max Memory Used: 35 MB	
RequestId: 2fbcfe89-d08d-11e6-a91d-4fb848ee7914 Process exited before completing request

Node version: v6.5.0
npm version: 3.10.3

edited:
even after adding the changes proposed in #9 and #11 , I'm still getting the same error.

Video link not available.

Hello! I'm interested in contributing in Alexa by adding new skills. I was going through the readme of this repository but found that the video link is not working.

Kindly update the video link on how to add Alexa skills.

Repeat Intent - Certification failure.

The code doesn't seem to support the Repeat Intent command when in an event or description - I've failed certification because it doesn't support this functionality.

Lambda Blueprint for Trivia Skill doesn't include iCal

I'm new to node.js so feel free to correct me, but I've tried the step by step tutorial a few times and consistently receive the lambda function error: "errorMessage": "Cannot find module 'ical'"

iCal doesn't appear to be included in the modules and it isn't listed as a dependency in the modules.json file in the blueprint, even though it is on the modules.json file on the github.

Can you update the blueprint the include this dependency?

Getting an error "Cannot find module 'ical' "

I executed the same code but i am facing error that " Cannot find module 'ical' ". Please help me to resolve the issue ASAP. How can i install ical package in node js in Lambda.

Lambda is rejecting the code

After I copied and pasted the code from Index.js, the Lambda function's inline editor is flagging a number of lines of code as having errors. The last error being "Too many errors. (48% scanned)".

Thanks in advance for any tips or guidance,
Sam

Instructions: `npm install` omitted at Step 2.3

I could be wrong as I am new to node, but it seems a step is omitted from the instructions.

I was getting errors like "Unable to import module 'index': Error at Function.Module._resolveFilename" which seems to happen to numerous people following the tutorial. A common cause is failing to have index.js at the root of the uploaded zip but that was not my issue.

However, I found that I had to run npm install at Step 2.3 before creating the archive (Step 2.4) in order to get the ical and other dependencies besides alexa-sdk downloaded and included in the archive.

I suspect that the command in Step 2.3 npm install --save alexa-sdk only installs the alexa-sdk not the other dependencies.

Once I figured out to run npm install in my src directory before Step 2.4 the lambda stopped throwing errors and began working as expected.

The remote endpoint could not be called, or the response it returned was invalid.

I thought I followed all the steps, renaming the app both within the index.js and the developer portal. and changing the calendar file URL to one that I am subscribed to. I receive this error msg when trying to test:

The remote endpoint could not be called, or the response it returned was invalid.

My cloud log says

Unable to import module 'index': Error
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/var/task/index.js:2:12)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)

I have an index.js file. I'm on Windows, and am zipping the contents of the src directory and not the directory itself, per the tutorial instructions.. Any advice most appreciated!

Update: I tried running through the tutorial again without changing ANYTHING - didn't change app name, didn't change calendar URL - and I'm having the same problem. The much easier Hello World tutorial worked, though.

Note: I now got to the point where I have a similar problem to another issue, so I'm closing this one and moving comments to that thread.

How to start a new search after finding events?

I've had good luck using your code to access a calendar for a Meetup.com group. However, I am running into an issue with the skill just ending after a user has found events in a date range. How could I adjust the code so that the user can go back and search for a new date or date range?

Issues with event times

Extremely new to this, so sorry if I'm missing something obvious. I got this up and running, but the time of the event is always returned as undefined. For example:

The First event is, (event here) at undefined on Fri Feb 17 2017

Also, the calendar I'm reading has some events that are from 10:00AM to 11:00PM (Taco Tueday!), and they are completely ignored, is there some setting where it's ignoring events that are longer than a certain number of hours?

Thanks for any help.

Process exited before completing request

Skill is not starting, when I'm testing it on Lamda Testing
Here is my log output

"
TART RequestId: 5fbdb50d-b3ff-11e7-87de-33ac6e4b53aa Version: $LATEST
2017-10-18T12:25:06.366Z bb576013-b3fe-11e7-9013-d3268e7deffe TypeError: alexa.emit(...).listen is not a function
at /var/task/index.js:197:40
at Request._callback (/var/task/node_modules/ical/node-ical.js:10:14)
at self.callback (/var/task/node_modules/request/request.js:199:22)
at emitOne (events.js:77:13)
at Request.emit (events.js:169:7)
at Request.onRequestError (/var/task/node_modules/request/request.js:821:8)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at Socket.socketOnEnd (_http_client.js:285:9)
at emitNone (events.js:72:20)
END RequestId: 5fbdb50d-b3ff-11e7-87de-33ac6e4b53aa
REPORT RequestId: 5fbdb50d-b3ff-11e7-87de-33ac6e4b53aa Duration: 252.18 ms Billed Duration: 300 ms Memory Size: 128 MB Max Memory Used: 43 MB
RequestId: 5fbdb50d-b3ff-11e7-87de-33ac6e4b53aa Process exited before completing request

"

Kindly help please!!!

ical.fromURL function does not work

Hi all, the fromURL() function,

ical.fromURL(URL, options, function(error, data){
// some code using data 
});

, of ical package does not seem to work if the URL provided is correct. Precisely, it works but it does not go inside the function where i can access the data. My guess is that Lambda is blocking(?) the code from accessing the URL.. Or is this because the function is asynchronous? Am i the only one having the issue??

How to Remove date of event

When the app finds an event it tells you the event title, then repeats the date of the event. How can I remove it. I only want it to tell me the event title.

Thank you

HelpMessage suggests utterances that do not work

HelpMessage="Here are some things you can say: Is there an event today? Is there an event on the 18th of July? What are the events next week? Are there any events tomorrow? What would you like to know?"

These phrases do not work with the provided utterances. Rather than add more utterances I would recommend shortening the HelpMessage to:

HelpMessage="Try saying, What's Happening today? What's happening on January 7th?"

Emission of :responseReady makes code exists before ical.fromURL callback is called

This line:

204 this.emit(':responseReady');

is making the handler to return a response without waiting the ical.fromURL callback to be called.

Therefore, all the requests I'm sending receives a response as:

{ "version": "1.0", "response": { "shouldEndSession": true }, "sessionAttributes": { "STATE": "_SEARCHMODE" }, "userAgent": "ask-nodejs/1.0.25 Node/v6.10.3" }

After removing that line, the application gets back to normal responses!
Can we take it off?

Unexpected exception 'Error: No 'Unhandled' function defined for event: Unhandle

after installing the sample and running the example, I am getting following error:

node index.js
Warning: Application ID is not set
Unexpected exception 'Error: No 'Unhandled' function defined for event: Unhandle
d':
Error: No 'Unhandled' function defined for event: Unhandled
at AlexaRequestEmitter.EmitEvent (C:\Users\armkha01\AndroidStudioProjects\sk
ill-sample-nodejs-calendar-reader\src\node_modules\alexa-sdk\lib\alexa.js:194:15
),

this is due to "attributes": {}, attribute does not contains state by default, and example does not initilize the state.

Reads events from two different days

Hello,

When I ask the calendar reader app to read an event on say Monday it will read the events on Monday and Tuesday or sometimes it will read the Tuesday event first and then the Monday event.

I would like to know if this can be fixed or if anyone else has had a similar issue

This is my Lambda Request for Monday:
{
"session": {
"sessionId": "SessionId.858c21f7-bf3e-4ffe-8994-505d6d66376c",
"application": {
"applicationId": "amzn1.ask.skill.ef568806-cfe5-4e88-9a12-d54eac21a21d"
},
"attributes": {
"STATE": "_SEARCHMODE"
},
"user": {
"userId": "amzn1.ask.account.AE4MEQR3EXL2PXBDU6A57X2KJ3PYFKDTGGCG264MNNIFKRWU6GH4XMRKAQSZG35CDJWEQ4DMNGINLSGU656QUWAJQFH6EZIGPZAFXRIZNBYN7OAXJSJL4YZ5KRQ6IYBCLUGBR7TAG3FKFPZ3RQU53NASGASWTRNA6CGM47X3SGNXPRQULHHNQRVVRKLIAPZBLT6QXXRQJWPCG3Q"
},
"new": false
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.05bb9dc1-8044-4094-8193-e1475361f706",
"locale": "en-US",
"timestamp": "2017-03-26T08:16:00Z",
"intent": {
"name": "searchIntent",
"slots": {
"date": {
"name": "date",
"value": "2017-03-27"
}
}
}
},
"version": "1.0"
}

This is my Lambda Response where it reads back Tuesday then Monday :
{
"version": "1.0",
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": " There are 2 events has been sent to your Alexa app: Here are the first 2. The First event is, For Lunch…..Sloppy fries with meat and cheese ..... Pretzel rods…..green beans….. fruit slushie…..milk………Sloppy fry day is so messy…wear your old clothes at undefined on Tue Mar 28 2017. The Second event is, For Breakfast.....G Force Bar..... Cereal..... Juice.....and or.....Fruit Cup... Milk............. For Lunch..... Homemade Grilled Cheese Sandwich..... Elementary..... Tomato Soup..... Middle School..... Tomato Soup or Chili….. Chilled Pears..... Milk……. Yummy in my Tummy at . on Mon Mar 27 2017. You can say the event number for more information. "
},
"card": {
"content": "For Lunch…..Sloppy fries with meat and cheese ..... Pretzel rods…..green beans….. fruit slushie…..milk………Sloppy fry day is so messy…wear your old clothes at undefined on Tue Mar 28 2017\n\n For Breakfast.....G Force Bar..... Cereal..... Juice.....and or.....Fruit Cup... Milk............. For Lunch..... Homemade Grilled Cheese Sandwich..... Elementary..... Tomato Soup..... Middle School..... Tomato Soup or Chili….. Chilled Pears..... Milk……. Yummy in my Tummy at . on Mon Mar 27 2017\n\n ",
"title": "Events",
"type": "Simple"
},
"reprompt": {
"outputSpeech": {
"type": "SSML",
"ssml": " Give me an event number to hear more information. "
}
},
"shouldEndSession": false
},
"sessionAttributes": {
"STATE": "_DESKMODE"
}
}

Thanks for any help in advance

ical.fromURL in ical not working

I am trying to fix an issue with ical.fromURL(URL, {}, function (error, data) . My problem is it is not taking the function. When I tried returning a value from the function it returns "Undefined". Did anyone encounter this problem? How to fix this?

Line 11 Parsing Error

Hello all,

In index.js

Line 11: const alexa; is running into parsing error due to an unexpected token.

Not sure if this has any effects on the code.

Can't search calendar by month

I am unable to search a calendar by month even when there are events scheduled during that month.

Example: What events are happening in October?
Result: Here are some things you can say: Is there an event today? Is there an event on the 18th of July? What are the events next week? Are there any events tomorrow? What would you like to know?

also had to update change the following to get the lambda interaction working in the index file:
alexa.APP_ID = APP_ID;

Error: No 'Unhandled' function defined for event: Unhandled

Hi,

Get this error when i try to open skill:

{
  "session": {
    "sessionId": "SessionId",
    "application": {
      "applicationId": "amzn1.ask.skill."
    },
    "attributes": {},
    "user": {
      "userId": "amzn1.ask.accoun"
    },
    "new": true
  },
  "request": {
    "type": "IntentRequest",
    "requestId": "EdwRequestId.a648b85c-0243-4214-8108-a132ab7442f4",
    "locale": "en-US",
    "timestamp": "2016-11-16T07:43:36Z",
    "intent": {
      "name": "searchIntent",
      "slots": {
        "date": {
          "name": "date"
        }
      }
    }
  },
  "version": "1.0"
}

Unexpected exception 'Error: No 'Unhandled' function defined for event: Unhandled':
Error: No 'Unhandled' function defined for event: Unhandled
at AlexaRequestEmitter.EmitEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:194:15)
at AlexaRequestEmitter.ValidateRequest (/var/task/node_modules/alexa-sdk/lib/alexa.js:160:23)
at AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:116:25)
at AlexaRequestEmitter.Object.defineProperty.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:91:31)
at exports.handler (/var/task/index.js:270:11)

Any clue?

I have deployed the src exactly the way its defined.

Thanks,
Shane.

Some evening events being read as happening on next day

The calendar skill is reading out some of my evening events as being on the next day. My guess is that this is a timezone problem. My Google calendar is set to US Eastern time GMT-4. I tried adding process.env.TZ = 'America/New_York' to the app's index.js file, but that doesn't help. Any ideas? Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.