Skip to content

Instantly share code, notes, and snippets.

@dmurawsky
Last active March 11, 2018 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmurawsky/e45ce462f6d0b3a5fd1aab2a6260f675 to your computer and use it in GitHub Desktop.
Save dmurawsky/e45ce462f6d0b3a5fd1aab2a6260f675 to your computer and use it in GitHub Desktop.
example lex lambda
exports.availability = (event, context, cb) => {
context.callbackWaitsForEmptyEventLoop = false;
console.log(event, context);
return cb(null, {
dialogAction: {
type: "Close",
fulfillmentState: "Fulfilled",
message: {
contentType: "PlainText",
content: "Response from availability lambda"
}
}
});
};
exports.onboarding = (event, context, cb) => {
context.callbackWaitsForEmptyEventLoop = false;
console.log(event, context);
return cb(null, {
dialogAction: {
type: "Close",
fulfillmentState: "Fulfilled",
message: {
contentType: "PlainText",
content: "Response from onboarding lambda"
}
}
});
};
{
"messageVersion": "1.0",
"invocationSource": "FulfillmentCodeHook",
"userId": "wtu7jir2e3oe1ksgievdfix8jdei4s8x",
"sessionAttributes": {},
"requestAttributes": null,
"bot": {
"name": "MartinBot",
"alias": "$LATEST",
"version": "$LATEST"
},
"outputDialogMode": "Text",
"currentIntent": {
"name": "MoreNotTheAnswer",
"slots": {},
"slotDetails": {},
"confirmationStatus": "None"
},
"inputTranscript": "give me more!"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment