Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
[SELECTION_KEY_GOOGLE_HOME]: 'You selected the Google Home!',
[SELECTION_KEY_GOOGLE_PIXEL]: 'You selected the Google Home!',
[SELECTION_KEY_GOOGLE_PIXEL]: 'You selected the Google Pixel!',
[SELECTION_KEY_GOOGLE_ALLO]: 'You selected Google Allo!',
};
const intentSuggestions = [
'Basic Card',
'Browse Carousel',
'Carousel',
'List',
'Media',
'Suggestions',
];
const app = actionssdk({debug: true});
app.middleware((conv) => {
conv.hasScreen =
conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT');
conv.hasAudioPlayback =
conv.surface.capabilities.has('actions.capability.AUDIO_OUTPUT');
});
// Welcome
app.intent('actions.intent.MAIN', (conv) => {
conv.ask(new SimpleResponse({
speech: 'Hi there!',
text: 'Hello there!',
}));
conv.ask(new SimpleResponse({
speech: 'I can show you basic cards, lists and carousels ' +
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
'use strict';
const functions = require('firebase-functions');
const {actionssdk} = require('actions-on-google');
const app = actionssdk({debug: true});
app.intent('actions.intent.MAIN', (conv) => {
conv.ask('Hi! I can read out an ordinal like ' +
'123. Say a number.');
});
app.intent('raw.input', (conv, input) => {
const number = conv.arguments.get('ordinal');
conv.ask(`You said, ${number}`);
});
//Handles in-dialog conversation
app.intent('actions.intent.TEXT', (conv, input) => {
if (input === 'bye') {
return conv.close('Goodbye!');
}
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
'use strict';
const {actionssdk} = require('actions-on-google');
const Eliza = require('elizabot');
const functions = require('firebase-functions');
const app = actionssdk({debug: true});
/**
* Handles the MAIN intent coming from Assistant, when the user first engages
* with the app, expecting for an initial greeting from Eliza.
*/
app.intent('actions.intent.MAIN', (conv) => {
const eliza = new Eliza();
conv.data.elizaInstance = eliza;
conv.ask(eliza.getInitial());
});
/**
* Handles the intent where the user invokes with a query to be
* handled by Eliza.
*
* This intent is triggered when the user invokes the Raw Input
module.exports = async function ({ event, response }) {
const app = actionssdk();
app.intent('actions.intent.MAIN', conv => {
conv.ask(response.textResponse);
});
app.intent('actions.intent.TEXT', (conv, input) => {
if (response.closeGoogleActions){
conv.close(response.textResponse);
}
else {
conv.ask(response.textResponse);
}
});
return await app.handler(event, {});
}
[SELECTION_KEY_GOOGLE_PAY]: 'You selected Google Pay!',
[SELECTION_KEY_GOOGLE_PIXEL]: 'You selected Google Pixel!',
[SELECTION_KEY_GOOGLE_HOME]: 'You selected Google Home!',
};
const intentSuggestions = [
'Basic Card',
'Browse Carousel',
'Carousel',
'List',
'Media',
'Suggestions',
'Table',
];
const app = actionssdk({debug: true});
app.middleware((conv) => {
conv.hasScreen =
conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT');
conv.hasAudioPlayback =
conv.surface.capabilities.has('actions.capability.AUDIO_OUTPUT');
conv.hasWebBrowser =
conv.surface.capabilities.has('actions.capability.WEB_BROWSER');
if (!conv.hasScreen && (conv.rawInput !== 'media response' || 'media status')) {
conv.ask(`Hi there! Sorry, I'm afraid you'll have to switch to a ` +
`screen device or select the phone surface in the simulator.`);
return;
}
});
actionssdk,
BasicCard,
Button,
RegisterUpdate,
Suggestions,
UpdatePermission,
} = require('actions-on-google');
const {
getRandomTip,
getLatestTip,
getCategories,
registerUserForUpdate,
} = require('./tip-service');
const app = actionssdk({debug: true});
/** Query pattern parameters */
const Parameters = {
CATEGORY: 'category',
UPDATE_INTENT: 'UPDATE_INTENT',
};
/** App strings */
const RANDOM_CATEGORY = 'random';
const RECENT_TIP = 'most recent';
const CATEGORIES = 'categories';
const DAILY_NOTIFICATION_SUGGESTION = 'Send daily updates';
const ASK_CATEGORY_FLAG = 'ask_category';
const PUSH_NOTIFICATION_SUGGESTION = 'Alert me of new tips';
const DAILY_NOTIFICATION_ASKED = 'daily_notification_asked';
const PUSH_NOTIFICATION_ASKED = 'push_notification_asked';
const functions = require('firebase-functions');
const { actionssdk } = require('actions-on-google');
const app = actionssdk({
debug: true
});
app.intent('actions.intent.MAIN', conv => {
conv.close('Hello, world!');
});
exports.fulfillment = functions.https.onRequest(app);
import * as functions from 'firebase-functions';
import { actionssdk } from 'actions-on-google';
const app = actionssdk({
debug: true
});
app.intent('actions.intent.MAIN', (conv): void => {
conv.close('Hello, world!');
});
exports.fulfillment = functions.https.onRequest(app);
exports.handler = function(event, context, callback) {
const {actionssdk} = require('actions-on-google');
const app = actionssdk({debug: true});
app.intent('actions.intent.MAIN', (conv) => {
conv.ask('Hi!');
});
callback(null, {
statusCode: 200,
body: app
});
}