Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9af23d
commit 97667a3
Showing
1 changed file
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,46 @@ | ||
# Algolia Alexa Skills Kit Adapter | ||
# Algolia Alexa Skills Kit Adapter | ||
|
||
This is an adapter that allows you to use the Algolia search API easily within your Alexa Skills Kit Skill. | ||
|
||
```javascript | ||
let voiceSearch = algoliaAlexaAdapter({ | ||
algoliaAppId: 'APP_ID', | ||
alexaAppId: 'FROM_AMAZON_LAMBDA', | ||
defaultIndexName: 'products', | ||
comparisons: [{ | ||
'less than': '>', | ||
'greater than': '>' | ||
}], | ||
availableSorts: [{ | ||
indexName: 'products_PRICE_DESC', | ||
invocations: ['price descending', 'price low to high'] | ||
}, { | ||
indexName: 'products_PRICE_ASC', | ||
invocations: ['price ascending', 'price high to low'] | ||
}], | ||
handlers: { | ||
onLaunch: function(launchRequest, session, response) { | ||
// | ||
}, | ||
intentHandlers: { | ||
SearchProductIntent: { | ||
speechTemplate: 'The top product is {{name}} from {{brand}}. It costs ${{price}}.', | ||
emptyTemplate: function(data){ | ||
return 'There were no products for your {{data.query}} search.' | ||
}, | ||
comparisons: { | ||
'more expensive than': '>', | ||
'less expensive than': '<' | ||
}, | ||
facets: ['brand', 'availability'] | ||
}, | ||
HelpIntent: function(intent, session, response){ | ||
var speechOutput = 'Find one of 10,000 products from Best Buy, powered by Algolia.'; | ||
response.ask(speechOutput); | ||
} | ||
} | ||
} | ||
}); | ||
|
||
exports.handler = voiceSearch.search(event, context); | ||
``` |