
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
alexa-utils
Advanced tools
A simple library for making the development of Alexa (Amazon Echo) apps (Skills) easier with Node.js.
This library is very minimalistic as far as what features it supports. For example, this library will NOT handle cards, reprompts, session infomation, or account linking. Also, it doesn't support async functions at the moment, although it may be implemented in a later version. If you have any suggestions or bug fixes, please contact me or make a pull request.
npm install alexa-utils --save
This code will automatically create an express object pre-initialized with a specified route, enabled verification, and sample code to handle the three most common intents.
var alexaUtils = require('alexa-utils');
const PORT = 3000;
var app = alexaUtils.createServer('/alexa', false,
function(res, input) {
switch (input.type) {
case 'LaunchRequest':
alexaUtils.sendResponse(res, "Hello there!");
break;
case 'SessionEndedRequest':
alexaUtils.sendResponse(res, "Goodbye!");
break;
case 'IntentRequest':
alexaUtils.sendResponse(res, "I see that your favorite color is " + input.slots.color);
break;
}
}
);
app.listen(PORT, function() {
console.log('Alexa server listening on port ' + PORT);
});
express()
function(request, response)
; used for parsing data from a web clientfunction(request, response)
; used for sending data to a web clientprepareExpress(ExpressObject express, boolean debug = true)
Given the express object, it will add middleware for handling JSON and URL-Encoded requests. If debug
is set to false
, the express object will also be able to authenticate the said requests by checking if they come from the Amazon servers only. Note that this is REQUIRED if you are submitting your Alexa Skill app for publification.
bindRoute(ExpressObject express, String route, function callback(ResponseObject response, JsonObject requestInfo))
Given the express object, it will bind all Amazon Alexa requests to the specified route, and all requests will be piped to the specified function, which has a ResponseObject (necessary for sending back a response to the Alexa device), and a simplified JSON Object. Refer to the parseRequest
function for information about the JSON Schema.
createServer(String route, boolean debug, function callback(ResponseObject response, JsonObject requestInfo))
Essentially combines the prepareExpress
and bindRoute
, and returns a new ExpressObject all at once.
parseRequest(RequestObject request)
Constructs and returns a simplified JSON Object with the following JSON Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"type": {
"type": "string"
},
"name": {
"type": "string"
},
"slots": {
"type": "object",
"properties": {
"slot1": {
"type": "any"
},
"slot2": {
"type": "any"
},
"slot3": {
"type": "any"
}
}
}
}
}
Note that you can have as many slots as you need for your Alexa Skill app.
sendResponse(ResponseObject res, String text, boolean shouldEnd = true)
Sends a response to the Echo device with the specified text to say. The shouldEnd
variable specifies if the session between the user and the Echo device should end after sending that response.
FAQs
This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.
The npm package alexa-utils receives a total of 4 weekly downloads. As such, alexa-utils popularity was classified as not popular.
We found that alexa-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.