Comments (4)
To override a built-in function such as :ask
, simply register a handler with the same name.
For metrics logging, I would recommend simply logging it in your exports.handler
function in index.js
before your function code is executed.
E.g.
exports.handler = function(event, context, callback) {
// Log incoming event or just the intent
console.log('event:\n' + JSON.stringify(event, null, 4));
var alexa = Alexa.handler(event, context);
alexa.registerHandlers(...)
// Log with a callback
LogEventAsync(event, function() {
alexa.execute();
});
}
function LogEventAsync(event, callback) {
// Async call to emit metric
callback();
}
from alexa-skills-kit-sdk-for-nodejs.
@deegles so i want to log the response in addition to the event.
I was figuring that I would need to override :responseReady. Got a better suggestion?
from alexa-skills-kit-sdk-for-nodejs.
Hi Acinader,
One approach is to wrap your context.succeed
function. Try the following in your exports.handler
function, before calling alexa.execute()
.
You can do the same with context.fail
var succeed = context.succeed;
context.succeed = function (response) {
console.log('Response:\n' + JSON.stringify(response, null, 4));
succeed(response);
}
from alexa-skills-kit-sdk-for-nodejs.
👍 thanks
from alexa-skills-kit-sdk-for-nodejs.
Related Issues (20)
- Alexa hosted skill DynamoDB permission error HOT 12
- AskSdk.DynamoDbPersistenceAdapter Error: Could not read item HOT 2
- error when speak detects an accented character
- WebSocket error from ask-sdk-local-debug with EU region HOT 3
- ExpressAdapter.verifySignature causes skills to fail validation HOT 11
- Debugging doesn't work HOT 12
- Docs don't explain how to get Client ID
- Amazon content HOT 1
- Cannot send a proper response to Alexa after MQTT Publish
- Email HOT 1
- addAudioPlayerPlayDirective not playing some URLs
- Keep Compiled code in a dist folder
- `AlexaHouseholdListEvent.ItemsCreated` only ever provides a single ItemId HOT 2
- AskSdk.DynamoDbPersistenceAdapter error after upgrading to aws-sdk v2.1269.0
- The directive Navigation.SetDestination it's not accepted in the sdk
- Inaccurate type definitions in `ask-sdk-model`
- Aws sdk V2 in maintenance mode, upgrade for v3 HOT 3
- `withAskForPermissionsConsentCard` generating errors
- Missing support for SMAPI Metrics API v2 HOT 1
- Dynamic media URL and intercepting AudioPlayer fetch requests for HLS long streaming
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alexa-skills-kit-sdk-for-nodejs.