Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
webserver.post('/gactions/receive', function (req, res) {
// Now, pass the webhook into be processed
const assistant = new ActionsSDKApp({ request: req, response: res });
assistant.handleRequest(function (app) {
gactions_botkit.handleWebhookPayload(req, res, app);
});
});
function testActionsSdk(request: express.Request, response: express.Response) {
const app = new ActionsSdkApp({request, response});
const actionMap = new Map();
actionMap.set(app.StandardIntents.MAIN, () => {
const richResponse: Responses.RichResponse = app.buildRichResponse()
.addSimpleResponse('Hello world')
.addSuggestions(['foo', 'bar']);
app.ask(richResponse);
});
app.handleRequest(actionMap);
}
return (req, res) => {
console.log("Inbound request to: " + req.url)
const app = new ActionsSdkApp({
request: req,
response: res
});
app.handleRequest(fulfill(onUserSignedInHandlerProvider, conversationTimeout, shouldGetUsersNameFromGoogle));
}
};
expressApp.post('/', (request, response) => {
console.log('handle post');
const app = new ActionsSdkApp({request: request, response: response});
const runner = runnerFactory(story, app);
if (runner === null) {
throw new Error('Runner not found!');
}
function mainIntent (app) {
console.log('mainIntent');
runner.started = app.data.hasOwnProperty('restore');
runner.start();
}
function rawInput (app) {
console.log('rawInput');
if (app.getRawInput() === 'quit') {
app.tell('Goodbye!');
constructor(options){
for (let p of REQUIRED_PARAMETERS){
if (!options[p]){
throw new Error(`Required parameter: "${p}" for Google Assistant configuration not set.`);
}
}
this.project_id = options.project_id;
this.sdk = new ActionsSdkApp({
request: options.req,
response: options.res
});
}