SATISH
Created December 19, 2016

Israeli Friend

A skill that teaches about the Israel through Israeli Friend by using facts. Israel is a land of wondersA truly wonderful skill.

21
Israeli Friend

Things used in this project

Story

Read more

Schematics

user flow diagram with alexa

Code

index.js

JavaScript
/**Jesus is Lord**//**"ISRAEL FACTS:",    Copyright satish. All Rights Reserved.    Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.*//** * This example has no external dependencies or session management, and shows the most basic way to create a Lambda function for handling Alexa Skill requests. * * Examples: * One-shot model: *  User: "Alexa, ask Israelite for a ISRAEL fact" *  Alexa: "Here's your ISRAEL Fact: ..." *//** * App ID for the skill */var APP_ID = undefined; //OPTIONAL: replace with "amzn1.echo-sdk-ams.app.[your-unique-value-here]";/** * Array containing ISRAEL FACTS. */var ISRAEL_FACTS = [		"There are over 100 sushi restaurants in Tel Aviv making it the city with the most sushi restaurants per capita after Tokyo and NYC.",	                "Israel has the third highest rate of entrepreneurship in the world.",	                "It has the highest rate of entrepreneurship among women and people over 55 in the world.",	                "Israel was the first country to ban underweight models.",	                "Israeli banknotes have braille markings on them.",	                "Israel won the Eurovision song competition three times.",	                "The last time they won, they were represented by a transgender pop star, Dana International. The only other time that’s happened is this year’s winner, Conchita Wurst, from Austria.",	                "Israelis consume the third most amount of vegetables and sweets in the world.",	                "When Golda Meir became prime minister of Israel in 1969, she was only the third woman elected to lead a country in the modern world. ",	                "The largest known dog cemetery in the ancient world was discovered in the coastal city of Ashkelon.",	                "There’s a rollerblading party that happens every Tuesday night in Tel Aviv.",	                "Out Magazine names Israel the gay capital of the Middle East.",	                "The country has the most Bauhaus buildings in the world.",	                "Israel has 137 official beaches (but only 273 km of coastline).",	                "In regards to its population, Israel has the highest ratio of college degrees.",	                "Israel has the highest ratio of the ratio of its museums and startup companies!",	                "Motorola developed the cell phone in Israel.",	                "Voicemail technology was developed in Israel.",	                "The first antivirus software for computers was created in Israel in 1979.",	                "Israel has two official languages: Hebrew and Arabic.",	                "Israel published more books translated from other languages than any other nation in the world.",	                "The city of Beersheba has the highest number of chess grandmasters per capita in the world.",	                "Only two countries began the 21st century with a net gain in their number of trees; Israel was one of them.",	                "The opening scene of the Al Pacino film The Insider was shot in Israel.",	                "Haifa, Israel has one of the smallest subway systems in the world with a 1.8-km track and only four carriages — how cute!",	                "Israel is one of only three democracies in the world without a codified constitution. The other two are New Zealand and Britain.",	                "The Sea of Galilee — located .212 km below sea level — is the lowest freshwater lake in the world (and the largest in Israel). ",	                "The Dead Sea is the lowest place on Earth.",	                "People can easily float in the Dead Sea due to its unusually high salt concentration. It’s almost impossible to dive into it.",	                "Israel is the only country to revive an unspoken language and establish it as its national tongue.",	                "Jerusalem’s Mount of Olives is the world’s oldest continuously used cemetery.",	                "El Al, Israel’s national airline, set the world record for the most passengers on a commercial flight.",	                "The world’s largest pepper was grown in Israel’s Moshav Ein Yahav, as recorded by The Guinness Book of World Records in 2013.",	                "Life expectancy at birth in Israel is at 82 years (two years more than the OECD average).",	                "Eilat and the Hula Valley Reserve are some of the best bird-watching sites in the world",	                "Israel’s national bird is the hoopoe.",	                "Heart tissue regeneration is possible in the U.S. thanks to Israeli stem-cell technology.",	                "A cooking oil developed in Israel is capable of breaking up cholesterol and other blood fats.",	                "An Israeli company has developed the world’s first jellyfish repellent.",	                "Israel is one of only nine countries in the world that can launch its own satellites into space.",	                "AOL Instant Messaging was designed by an Israeli software company.",	                "Yityish Aynaw became Israel’s first Ethiopian Miss Israel in 2013.",	                "Israeli scientists have discovered the cause of chronic bad breath and an easy way to fix it!",	                "More than 44% of all lawyers registered in Israel are women.",	                "Israel chose its first woman president of the Supreme Court, Dorit Beinisch, who served from 2006-2012.",	                "Israel has the world’s second highest per capita of new books.",	                "A group of Israeli artists have started bus stop libraries that are available free of charge to commuters traveling across Israel.",	                "Israel’s national flower is the Cyclamen persicum.",	                "Last Valentine’s Day, 60 million Israeli flowers were sent to Europe for sale.",	                "Israeli cows produce more milk per cow than almost any country in the world, vying only with South Korea. ",	                "With peanuts introduced to their diets earlier (mostly in the form of the snack, Bamba), babies in Israel are 10 times less likely to suffer from a peanut allergy than Jewish children in the UK. ",	                "Israel is alone in having revived an unspoken language as its national tongue.",	                "Israel is one of only two countries that began the 21st century with a net gain in the number of its trees. ",	                "Dizengoff Street in Tel Aviv is the most expensive site on the official Israeli Monopoly board.",	                "The Mighty Morphin’ Power Rangers TV series was produced by Israeli Haim Saban.",	                "In 1966, Shai Agnon became Israel’s first recipient of a Nobel Prize — for literature.",	                "Palwin wine, Israel’s oldest brand, was first produced by the Palestine Wine and Trading Company, established in 1898. One explanation for why the different variations are identified by numbers is that they refer to different Israeli bus routes.",	                "Tel Aviv is a Unesco heritage site in recognition of the 4,000 Bauhaus buildings that were built in the city in the 1930s and ’40s.",	                "There are more than 40 kosher McDonald’s in Israel. The only one outside the Jewish state is in Buenos Aires.",	                "In 1992, Israel experienced such severe snow that several centimetres fell in the Negev desert.",	                "Benjamin Netanyahu’s office spent 10,000 shekels on ice cream last year, according to his 2012 budget report.",	                "The World Centre of the Bahai faith is located in the Israeli cities of Acre and Haifa.",	                "Haifa’s Carmelit transport system is one of the smallest subway systems in the world, with four carriages and a track of just 1.8 km.",	                "Some buses and stations around Israel bear the inscription “You shall rise before the aged and show deference to the old” — a quote from Leviticus intended to encourage courtesy among passengers.",	                "An estimated million notes are left in the Kotel each year — and cleaned out before Pesach and Rosh Hashanah. ",	                "There are just 40 independent bookstores in Israel.",	                "The largest known dog cemetery in the ancient world was unearthed in Ashkelon.",	                "Beersheva has the largest number of chess grandmasters per capita of any city in the world",	                "Israeli bank notes have Braille on them.",	                "The glue on Israeli stamps is kosher.",	                "In 2009, basketball player Omri Caspi became the first Israeli to be selected in the first round of the prestigious annual NBA draft.",	                "Israel has won the Miss World contest once, in 1998. The winner, Linor Abargil, subsequently became known as a campaigner against sexual violence. ",	                "Israel celebrates its version of mother’s day on Shevat 30, the date that Henrietta Szold —the founder of Hadassah — marked her birthday.",	                "Microsoft has more employees in israel than it does per capita anywhere in the world.",	                "In July last year, a team of crafty-minded folk in Netanya broke the world record for the largest sock mosaic, using 12,000 in total.",	                "Per square kilometre, Israel has one of the highest levels of bird traffic in the world. Over 500 million migrating birds cross its airspace.",	                "An Israeli company has developed the world’s first jellyfish repellent.",	                "Every year, an Israeli Arab hotel manager called Jaaber Hussein buys all of the state’s chametz for Pesach. ",	                "In February, a green pepper grown in Moshav Ein Yahav claimed the record for the world’s largest, weighing half a kilogram.",	                "The record for rubbish generated was set by Eilat in 2011 — 3.3 kg per person per day.",	                "There are around 273 kibbutzim in Israel.",	                "According to the latest figures available, the most popular name for Israeli babies — both boys and girls — is Noam.",	                "Politicians hoping to become Israel’s president should go by the names of either Yitzhak or Chaim — there have been two of each in the role since the establishment of the state.",	                "It is well known that the Dead Sea is the lowest place on earth — less well known is that it is 850 feet lower than the next lowest place — Lake Assal, in Djibouti.",	                "The Dead Sea is also 8.6 times saltier than the ocean.",	                "Bamba, Israel’s favourite snack, was first produced in 1964 as cheese-flavoured. Only two years later did acquire its much-loved peanut butter flavour.",	                "The opening scene of the Al Pacino film The Insider was shot in Israel – although it was set in Lebanon.",	                "The scene in which Tel Aviv beach is shown in Steven Spielberg’s Munich, was actually filmed in Malta.",	                "Israel has the highest number of museums per head in the world.",	                "More than nine out of 10 Israeli homes use solar power to heat water. ",	                "You can buy hummus flavoured ice cream in a shop in Jaffa.",	                "Napoleon tried to lay siege to Acre in 1799. There is a “Napoleon Hill” in the city.",	                "There are 285 replica models of historical, cultural and religious sites on display at the tourist museum Mini Israel.",	                "Last year, Israel became the first country to place a ban on the use of underweight models on catwalks.",	                "Israeli inventor Rafi Yoeli is currently building the world’s first flying car.",	                "People who keep Shabbat can buy car insurance which doesn’t cover Saturdays, making it cheaper. ",	                "The Mount of Olives in Jerusalem is the world’s oldest continuously used cemetery ",	                "Israel was the first country to sign up to the Kimberly process, the international standard that certifies diamonds as being “conflict free”. ",	                "The diet of animals at the biblical zoo of Jerusalem is altered over Pesach in accordance with kashrut.",	                "Akhzivland, near Nahariya, was declared independent by resident Eli Avivi in 1970, after years battling with the government over planning permission.",	                "Writer Leon Uris’s Israel epic Exodus, stayed on the New York Times Top 10 best-seller list for more than a year.",	                "Israeli scientists have ruled that giraffe milk is kosher.",	                "Alexander the Great is said to have entered Israel in 333 BCE via the caves at Rosh Hanikra ",	                "Adi Rotem is the current female Thai boxing world champion . ",	                "The word “Israel” in morse code would be: .. ... .-. .- . .-.. ",	                "The town of Kiryat Shemona is named after eight men who fell defending Tel Hai in 1920.",	                "Beersheva is twinned with 14 towns and cities around the world.",	                "Israeli academics produce more scientific papers per capita than anywhere else in the world.",	                "Israel has appeared in the World Cup finals only once, in 1970.",	                "Philanthropist Baron de Rothschild died in 1934 in France but, after independence, his remains were transported to Israel.",	                "Israel is one of only three democracies in the world without a codified constitution. The others are Britain and New Zealand.",	                "By law, the Jewish National and University Library receives copies of every book printed in Israel.",	                "Languages spoken in Israel include Marathi, northern Uzbek and Aramaic. ",	                "The most common street name in Israel is Hazait. It means “Olive Street”.",	                "Israel has two official languages: Hebrew and Arabic",	                "Israel is only 1/6 of 1% of the landmass of the Middle East (Israel is roughly half the size of Lake Michigan).",	                "Golda Meir was the 3rd woman in history to serve as a country’s prime minister.",	                "Israel’s population has reached 8 million as of Independence Day 2013!",	                "Israel has won five bronze Olympic medals, one silver and one gold.",	                "Developed by Major Uzi Gaf, more than 10 million Uzi machine guns have been build since 1948.",	                "34 political parties participated in Israel’s 2013 elections.",	                "Israel has more museums per capita than any other country in the world.",	                "The Dead Sea in Israel is the lowest point on earth, at 1,315 feet below sea level at its lowest point.",	                "Israel is the only liberal democracy in the middle east.",	                "Ever wondered if the glue on Israel’s stamps are kosher? It is.",	                "There are also kosher McDonald’s.",	                "In many Israeli bus stops, you can find a box for tzedakah (charitable giving).",	                "With more than 3,000 high-tech companies and start-ups, Israel has the highest concentration of hi-tech companies in the world (apart from the Silicon Valley).",	                "Most of the Windows NT operating system was developed by Microsoft-Israel",	                "The Pentium MMX Chip technology was designed in Israel at Intel.",	                "Voice mail technology was also developed in Israel.",	                "Four young Israelis developed the technology for AOL Instant Messenger and ICQ."],            "SKILL_NAME" : "British ISRAEL Facts",            "GET_FACT_MESSAGE" : "Here's your ISRAEL fact: ",            "HELP_MESSAGE" : "You can say Israelite tell me a ISRAEL fact, or, you can say exit... What can I help you with?",            "HELP_REPROMPT" : "What can I help you with?",            "STOP_MESSAGE" : "Goodbye!"        }    },    "en-US": {        "translation": {            "FACTS": [	"There are over 100 sushi restaurants in Tel Aviv making it the city with the most sushi restaurants per capita after Tokyo and NYC.",	                "Israel has the third highest rate of entrepreneurship in the world.",	                "It has the highest rate of entrepreneurship among women and people over 55 in the world.",	                "Israel was the first country to ban underweight models.",	                "Israeli banknotes have braille markings on them.",	                "Israel won the Eurovision song competition three times.",	                "The last time they won, they were represented by a transgender pop star, Dana International. The only other time that’s happened is this year’s winner, Conchita Wurst, from Austria.",	                "Israelis consume the third most amount of vegetables and sweets in the world.",	                "When Golda Meir became prime minister of Israel in 1969, she was only the third woman elected to lead a country in the modern world. ",	                "The largest known dog cemetery in the ancient world was discovered in the coastal city of Ashkelon.",	                "There’s a rollerblading party that happens every Tuesday night in Tel Aviv.",	                "Out Magazine names Israel the gay capital of the Middle East.",	                "The country has the most Bauhaus buildings in the world.",	                "Israel has 137 official beaches (but only 273 km of coastline).",	                "In regards to its population, Israel has the highest ratio of college degrees.",	                "Israel has the highest ratio of the ratio of its museums and startup companies!",	                "Motorola developed the cell phone in Israel.",	                "Voicemail technology was developed in Israel.",	                "The first antivirus software for computers was created in Israel in 1979.",	                "Israel has two official languages: Hebrew and Arabic.",	                "Israel published more books translated from other languages than any other nation in the world.",	                "The city of Beersheba has the highest number of chess grandmasters per capita in the world.",	                "Only two countries began the 21st century with a net gain in their number of trees; Israel was one of them.",	                "The opening scene of the Al Pacino film The Insider was shot in Israel.",	                "Haifa, Israel has one of the smallest subway systems in the world with a 1.8-km track and only four carriages — how cute!",	                "Israel is one of only three democracies in the world without a codified constitution. The other two are New Zealand and Britain.",	                "The Sea of Galilee — located .212 km below sea level — is the lowest freshwater lake in the world (and the largest in Israel). ",	                "The Dead Sea is the lowest place on Earth.",	                "People can easily float in the Dead Sea due to its unusually high salt concentration. It’s almost impossible to dive into it.",	                "Israel is the only country to revive an unspoken language and establish it as its national tongue.",	                "Jerusalem’s Mount of Olives is the world’s oldest continuously used cemetery.",	                "El Al, Israel’s national airline, set the world record for the most passengers on a commercial flight.",	                "The world’s largest pepper was grown in Israel’s Moshav Ein Yahav, as recorded by The Guinness Book of World Records in 2013.",	                "Life expectancy at birth in Israel is at 82 years (two years more than the OECD average).",	                "Eilat and the Hula Valley Reserve are some of the best bird-watching sites in the world",	                "Israel’s national bird is the hoopoe.",	                "Heart tissue regeneration is possible in the U.S. thanks to Israeli stem-cell technology.",	                "A cooking oil developed in Israel is capable of breaking up cholesterol and other blood fats.",	                "An Israeli company has developed the world’s first jellyfish repellent.",	                "Israel is one of only nine countries in the world that can launch its own satellites into space.",	                "AOL Instant Messaging was designed by an Israeli software company.",	                "Yityish Aynaw became Israel’s first Ethiopian Miss Israel in 2013.",	                "Israeli scientists have discovered the cause of chronic bad breath and an easy way to fix it!",	                "More than 44% of all lawyers registered in Israel are women.",	                "Israel chose its first woman president of the Supreme Court, Dorit Beinisch, who served from 2006-2012.",	                "Israel has the world’s second highest per capita of new books.",	                "A group of Israeli artists have started bus stop libraries that are available free of charge to commuters traveling across Israel.",	                "Israel’s national flower is the Cyclamen persicum.",	                "Last Valentine’s Day, 60 million Israeli flowers were sent to Europe for sale.",	                "Israeli cows produce more milk per cow than almost any country in the world, vying only with South Korea. ",	                "With peanuts introduced to their diets earlier (mostly in the form of the snack, Bamba), babies in Israel are 10 times less likely to suffer from a peanut allergy than Jewish children in the UK. ",	                "Israel is alone in having revived an unspoken language as its national tongue.",	                "Israel is one of only two countries that began the 21st century with a net gain in the number of its trees. ",	                "Dizengoff Street in Tel Aviv is the most expensive site on the official Israeli Monopoly board.",	                "The Mighty Morphin’ Power Rangers TV series was produced by Israeli Haim Saban.",	                "In 1966, Shai Agnon became Israel’s first recipient of a Nobel Prize — for literature.",	                "Palwin wine, Israel’s oldest brand, was first produced by the Palestine Wine and Trading Company, established in 1898. One explanation for why the different variations are identified by numbers is that they refer to different Israeli bus routes.",	                "Tel Aviv is a Unesco heritage site in recognition of the 4,000 Bauhaus buildings that were built in the city in the 1930s and ’40s.",	                "There are more than 40 kosher McDonald’s in Israel. The only one outside the Jewish state is in Buenos Aires.",	                "In 1992, Israel experienced such severe snow that several centimetres fell in the Negev desert.",	                "Benjamin Netanyahu’s office spent 10,000 shekels on ice cream last year, according to his 2012 budget report.",	                "The World Centre of the Bahai faith is located in the Israeli cities of Acre and Haifa.",	                "Haifa’s Carmelit transport system is one of the smallest subway systems in the world, with four carriages and a track of just 1.8 km.",	                "Some buses and stations around Israel bear the inscription “You shall rise before the aged and show deference to the old” — a quote from Leviticus intended to encourage courtesy among passengers.",	                "An estimated million notes are left in the Kotel each year — and cleaned out before Pesach and Rosh Hashanah. ",	                "There are just 40 independent bookstores in Israel.",	                "The largest known dog cemetery in the ancient world was unearthed in Ashkelon.",	                "Beersheva has the largest number of chess grandmasters per capita of any city in the world",	                "Israeli bank notes have Braille on them.",	                "The glue on Israeli stamps is kosher.",	                "In 2009, basketball player Omri Caspi became the first Israeli to be selected in the first round of the prestigious annual NBA draft.",	                "Israel has won the Miss World contest once, in 1998. The winner, Linor Abargil, subsequently became known as a campaigner against sexual violence. ",	                "Israel celebrates its version of mother’s day on Shevat 30, the date that Henrietta Szold —the founder of Hadassah — marked her birthday.",	                "Microsoft has more employees in israel than it does per capita anywhere in the world.",	                "In July last year, a team of crafty-minded folk in Netanya broke the world record for the largest sock mosaic, using 12,000 in total.",	                "Per square kilometre, Israel has one of the highest levels of bird traffic in the world. Over 500 million migrating birds cross its airspace.",	                "An Israeli company has developed the world’s first jellyfish repellent.",	                "Every year, an Israeli Arab hotel manager called Jaaber Hussein buys all of the state’s chametz for Pesach. ",	                "In February, a green pepper grown in Moshav Ein Yahav claimed the record for the world’s largest, weighing half a kilogram.",	                "The record for rubbish generated was set by Eilat in 2011 — 3.3 kg per person per day.",	                "There are around 273 kibbutzim in Israel.",	                "According to the latest figures available, the most popular name for Israeli babies — both boys and girls — is Noam.",	                "Politicians hoping to become Israel’s president should go by the names of either Yitzhak or Chaim — there have been two of each in the role since the establishment of the state.",	                "It is well known that the Dead Sea is the lowest place on earth — less well known is that it is 850 feet lower than the next lowest place — Lake Assal, in Djibouti.",	                "The Dead Sea is also 8.6 times saltier than the ocean.",	                "Bamba, Israel’s favourite snack, was first produced in 1964 as cheese-flavoured. Only two years later did acquire its much-loved peanut butter flavour.",	                "The opening scene of the Al Pacino film The Insider was shot in Israel – although it was set in Lebanon.",	                "The scene in which Tel Aviv beach is shown in Steven Spielberg’s Munich, was actually filmed in Malta.",	                "Israel has the highest number of museums per head in the world.",	                "More than nine out of 10 Israeli homes use solar power to heat water. ",	                "You can buy hummus flavoured ice cream in a shop in Jaffa.",	                "Napoleon tried to lay siege to Acre in 1799. There is a “Napoleon Hill” in the city.",	                "There are 285 replica models of historical, cultural and religious sites on display at the tourist museum Mini Israel.",	                "Last year, Israel became the first country to place a ban on the use of underweight models on catwalks.",	                "Israeli inventor Rafi Yoeli is currently building the world’s first flying car.",	                "People who keep Shabbat can buy car insurance which doesn’t cover Saturdays, making it cheaper. ",	                "The Mount of Olives in Jerusalem is the world’s oldest continuously used cemetery ",	                "Israel was the first country to sign up to the Kimberly process, the international standard that certifies diamonds as being “conflict free”. ",	                "The diet of animals at the biblical zoo of Jerusalem is altered over Pesach in accordance with kashrut.",	                "Akhzivland, near Nahariya, was declared independent by resident Eli Avivi in 1970, after years battling with the government over planning permission.",	                "Writer Leon Uris’s Israel epic Exodus, stayed on the New York Times Top 10 best-seller list for more than a year.",	                "Israeli scientists have ruled that giraffe milk is kosher.",	                "Alexander the Great is said to have entered Israel in 333 BCE via the caves at Rosh Hanikra ",	                "Adi Rotem is the current female Thai boxing world champion . ",	                "The word “Israel” in morse code would be: .. ... .-. .- . .-.. ",	                "The town of Kiryat Shemona is named after eight men who fell defending Tel Hai in 1920.",	                "Beersheva is twinned with 14 towns and cities around the world.",	                "Israeli academics produce more scientific papers per capita than anywhere else in the world.",	                "Israel has appeared in the World Cup finals only once, in 1970.",	                "Philanthropist Baron de Rothschild died in 1934 in France but, after independence, his remains were transported to Israel.",	                "Israel is one of only three democracies in the world without a codified constitution. The others are Britain and New Zealand.",	                "By law, the Jewish National and University Library receives copies of every book printed in Israel.",	                "Languages spoken in Israel include Marathi, northern Uzbek and Aramaic. ",	                "The most common street name in Israel is Hazait. It means “Olive Street”.",	                "Israel has two official languages: Hebrew and Arabic",	                "Israel is only 1/6 of 1% of the landmass of the Middle East (Israel is roughly half the size of Lake Michigan).",	                "Golda Meir was the 3rd woman in history to serve as a country’s prime minister.",	                "Israel’s population has reached 8 million as of Independence Day 2013!",	                "Israel has won five bronze Olympic medals, one silver and one gold.",	                "Developed by Major Uzi Gaf, more than 10 million Uzi machine guns have been build since 1948.",	                "34 political parties participated in Israel’s 2013 elections.",	                "Israel has more museums per capita than any other country in the world.",	                "The Dead Sea in Israel is the lowest point on earth, at 1,315 feet below sea level at its lowest point.",	                "Israel is the only liberal democracy in the middle east.",	                "Ever wondered if the glue on Israel’s stamps are kosher? It is.",	                "There are also kosher McDonald’s.",	                "In many Israeli bus stops, you can find a box for tzedakah (charitable giving).",	                "With more than 3,000 high-tech companies and start-ups, Israel has the highest concentration of hi-tech companies in the world (apart from the Silicon Valley).",	                "Most of the Windows NT operating system was developed by Microsoft-Israel",	                "The Pentium MMX Chip technology was designed in Israel at Intel.",	                "Voice mail technology was also developed in Israel.",	                "Four young Israelis developed the technology for AOL Instant Messenger and ICQ."]/** * The AlexaSkill prototype and helper functions */var AlexaSkill = require('./AlexaSkill');var Fact = function () {    AlexaSkill.call(this, APP_ID);};// Extend AlexaSkillFact.prototype = Object.create(AlexaSkill.prototype);Fact.prototype.constructor = Fact;Fact.prototype.eventHandlers.onSessionStarted = function (sessionStartedRequest, session) {    //console.log("onSessionStarted requestId: " + sessionStartedRequest.requestId + ", sessionId: " + session.sessionId);    // any initialization logic goes here};Fact.prototype.eventHandlers.onLaunch = function (launchRequest, session, response) {    //console.log("onLaunch requestId: " + launchRequest.requestId + ", sessionId: " + session.sessionId);    handleNewFactRequest(response);};/** * Overridden to show that a subclass can override this function to teardown session state. */Fact.prototype.eventHandlers.onSessionEnded = function (sessionEndedRequest, session) {    //console.log("onSessionEnded requestId: " + sessionEndedRequest.requestId + ", sessionId: " + session.sessionId);    // any cleanup logic goes here};Fact.prototype.intentHandlers = {    "GetNewFactIntent": function (intent, session, response) {        handleNewFactRequest(response);    },    "AMAZON.HelpIntent": function (intent, session, response) {        response.ask("You can say Israelite tell me a Israel fact, or, you can say exit... What can I help you with?", "What can I help you with?");    },    "AMAZON.StopIntent": function (intent, session, response) {        var speechOutput = "Goodbye";        response.tell(speechOutput);    },    "AMAZON.CancelIntent": function (intent, session, response) {        var speechOutput = "Goodbye";        response.tell(speechOutput);    }};/** * Gets a random new fact from the list and returns to the user. */function handleNewFactRequest(response) {    // Get a random Israel fact from the Israel FACTS list    var factIndex = Math.floor(Math.random() * ISRAEL_FACTS.length);    var randomFact = ISRAEL_FACTS[factIndex];    // Create speech output    var speechOutput = "Here's your Israel fact: " + randomFact;    var cardTitle = "Your Israel Fact";    response.tellWithCard(speechOutput, Israelite, speechOutput);}// Create the handler that responds to the Alexa Request.exports.handler = function (event, context) {    // Create an instance of the Israelite skill.    var fact = new Fact();    fact.execute(event, context);};

Sample Utterances

Tex
GetNewFactIntent a fact
GetNewFactIntent a Israel fact
GetNewFactIntent tell me a fact
GetNewFactIntent tell me a Israel fact
GetNewFactIntent give me a fact
GetNewFactIntent give me a Israel fact
GetNewFactIntent tell me trivia
GetNewFactIntent tell me a Israel trivia
GetNewFactIntent give me trivia
GetNewFactIntent give me a Israel trivia
GetNewFactIntent give me some information
GetNewFactIntent give me some Israel information
GetNewFactIntent tell me something
GetNewFactIntent give me something

IntentSchema

JSON
{
  "intents": [
    {
      "intent": "GetNewFactIntent"
    },
    {
      "intent": "AMAZON.HelpIntent"
    },
    {
      "intent": "AMAZON.StopIntent"
    },
    {
      "intent": "AMAZON.CancelIntent"
    }
  ]
 }

AlexaSkill

JavaScript
/**Jesus is Lord*//**    Copyright satish. All Rights Reserved.    Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES ORCONDITIONSOFANYKIND,eitherexpress or implied. See the License for the specific language governing permissions and limitationsunder the License.*/'use strict';function AlexaSkill(appId) {    this._appId = appId;}AlexaSkill.speechOutputType = {    PLAIN_TEXT: 'PlainText',    SSML: 'SSML'}AlexaSkill.prototype.requestHandlers = {    LaunchRequest: function (event, context, response) {        this.eventHandlers.onLaunch.call(this, event.request, event.session, response);    },    IntentRequest: function (event, context, response) {        this.eventHandlers.onIntent.call(this, event.request, event.session, response);    },    SessionEndedRequest: function (event, context) {        this.eventHandlers.onSessionEnded(event.request, event.session);        context.succeed();    }};/** * Override any of the eventHandlers as needed */AlexaSkill.prototype.eventHandlers = {    /**     * Called when the session starts.     * Subclasses could have overriden this function to open any necessary resources.     */    onSessionStarted: function (sessionStartedRequest, session) {    },    /**     * Called when the user invokes the skill without specifying what they want.     * The subclass must override this function and provide feedback to the user.     */    onLaunch: function (launchRequest, session, response) {        throw "onLaunch should be overriden by subclass";    },    /**     * Called when the user specifies an intent.     */    onIntent: function (intentRequest, session, response) {        var intent = intentRequest.intent,            intentName = intentRequest.intent.name,            intentHandler = this.intentHandlers[intentName];        if (intentHandler) {            console.log('dispatch intent = ' + intentName);            intentHandler.call(this, intent, session, response);        } else {            throw 'Unsupported intent = ' + intentName;        }    },    /**     * Called when the user ends the session.     * Subclasses could have overriden this function to close any open resources.     */    onSessionEnded: function (sessionEndedRequest, session) {    }};/** * Subclasses should override the intentHandlers with the functions to handle specific intents. */AlexaSkill.prototype.intentHandlers = {};AlexaSkill.prototype.execute = function (event, context) {    try {        console.log("session applicationId: " + event.session.application.applicationId);        // Validate that this request originated from authorized source.        if (this._appId && event.session.application.applicationId !== this._appId) {            console.log("The applicationIds don't match : " + event.session.application.applicationId + " and "                + this._appId);            throw "Invalid applicationId";        }        if (!event.session.attributes) {            event.session.attributes = {};        }        if (event.session.new) {            this.eventHandlers.onSessionStarted(event.request, event.session);        }        // Route the request to the proper handler which may have been overriden.        var requestHandler = this.requestHandlers[event.request.type];        requestHandler.call(this, event, context, new Response(context, event.session));    } catch (e) {        console.log("Unexpected exception " + e);        context.fail(e);    }};var Response = function (context, session) {    this._context = context;    this._session = session;};function createSpeechObject(optionsParam) {    if (optionsParam && optionsParam.type === 'SSML') {        return {            type: optionsParam.type,            ssml: optionsParam.speech        };    } else {        return {            type: optionsParam.type || 'PlainText',            text: optionsParam.speech || optionsParam        }    }}Response.prototype = (function () {    var buildSpeechletResponse = function (options) {        var alexaResponse = {            outputSpeech: createSpeechObject(options.output),            shouldEndSession: options.shouldEndSession        };        if (options.reprompt) {            alexaResponse.reprompt = {                outputSpeech: createSpeechObject(options.reprompt)            };        }        if (options.cardTitle && options.cardContent) {            alexaResponse.card = {                type: "Simple",                title: options.cardTitle,                content: options.cardContent            };        }        var returnResult = {                version: '1.0',                response: alexaResponse        };        if (options.session && options.session.attributes) {            returnResult.sessionAttributes = options.session.attributes;        }        return returnResult;    };    return {        tell: function (speechOutput) {            this._context.succeed(buildSpeechletResponse({                session: this._session,                output: speechOutput,                shouldEndSession: true            }));        },        tellWithCard: function (speechOutput, cardTitle, cardContent) {            this._context.succeed(buildSpeechletResponse({                session: this._session,                output: speechOutput,                cardTitle: cardTitle,                cardContent: cardContent,                shouldEndSession: true            }));        },        ask: function (speechOutput, repromptSpeech) {            this._context.succeed(buildSpeechletResponse({                session: this._session,                output: speechOutput,                reprompt: repromptSpeech,                shouldEndSession: false            }));        },        askWithCard: function (speechOutput, repromptSpeech, cardTitle, cardContent) {            this._context.succeed(buildSpeechletResponse({                session: this._session,                output: speechOutput,                reprompt: repromptSpeech,                cardTitle: cardTitle,                cardContent: cardContent,                shouldEndSession: false            }));        }    };})();module.exports = AlexaSkill;

Credits

SATISH

SATISH

3 projects • 0 followers

Comments