Skip to content

Commit

Permalink
Add interface for adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
dustincoates committed Dec 5, 2016
1 parent b9af23d commit 97667a3
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion README.md
@@ -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);
```

0 comments on commit 97667a3

Please sign in to comment.