Table of Contents generated with DocToc
This is an adapter that allows you to use the Algolia search API easily within your Alexa Skills Kit Skill. It provides tools for integrating Algolia search and a framework for structuring your Alexa skill.
Developed to be used on Amazon Lambda, you set up your intent handlers normally except for any that you want to leverage Algolia. For these handlers, a configuration object must be provided that defines the handler you want to call upon completion of the Algolia search. Algolia will be queried automatically, then provide an object with the results, intent, session, and response to your defined handler.
Here you can see an example usage:
const algoliaAlexaAdapter = ;const voiceSearch =;moduleexports = voiceSearch;
This function accepts a single argument, which is a configuration object.
This configuration object requires:
algoliaAppId: The app ID from your Algolia application
algoliaApiKey: The public search key associated with your Algolia application
defaultIndexName: The index you want to query on Algolia
handlers: An object with your standard request (
SessionEndedRequest) or built-in and intent handlers
Each handler can be configured in one of two ways. How it's configured depends on whether one wants to query Algolia first or not.
Specify a key-value pair where the key is the intent handler name and the value is a function. The function will accept no arguments, but has the current request information bound to
this, provided by the Alexa service via Lambda.
Specify a key-value pair where the key is the intent handler name and the value is an object. That object contains a function
answerWith which will be invoked following the Algolia search. This accepts one argument: an object with values for the keys of
results from Algolia and
event from the Alexa service.
$ npm run dev
Lints using eslint:
$ npm run lint
$ npm run lint:fix