npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

botium-connector-google-assistant

v0.0.8

Published

Botium Connector for Google Assistant

Downloads

25

Readme

Botium Connector for Google Assistant

NPM

Codeship Status for codeforequity-at/botium-connector-google-assistant npm version license

This is a Botium connector for testing your Action in Google Assistant.

Did you read the Botium in a Nutshell articles ? Be warned, without prior knowledge of Botium you won't be able to properly use this library!

How it works ?

Botium registers itself with the Google Assistant SDK as "virtual device" to talk to your Google Action.

IMPORTANT: The Google Assistant SDK this Botium connector is buildling upon is currently in ALPHA state and not considered to be ready for production use

It can be used as any other Botium connector with all Botium Stack components:

Requirements

  • Node.js and NPM
  • a Google Action, and user account with administrative rights
  • a project directory on your workstation to hold test cases and Botium configuration

Features

Requests

  • Sending button click event
#me
BUTTON yes

Botium Asserters to check response

#bot
BUTTONS yes|no|cancel
  • Media asserting (for Media Responses, and for image/media of complex UI elements)
#bot
MEDIA https://www.botium.at/images/logo.png
  • SSML asserting
#bot
<speak>Hello <break time='300ms'/> World</speak>
  • Card asserting. For Basic Card, Carousel, Browse Carousel, List, and Table components. With list you can assert title too
#bot
Title of List
CARDS First|Second
  • Asserting response containing more UI elements. For example Media Response is not a standalone UI element, works just with Simple Response, and Suggestion Chips. They can be asserted together:
#bot
simple response
MEDIA https://www.botium.at/images/logo.png
BUTTONS button1|button2

Account linking

  • You can test your action with non-linked user without any change
  • If you invoke the account linking process with this non-linked user, nothing happens. You got empty message return, and the account wont be linked
  • If you perm account linking in Actions console simulator, then you will get a linked user
  • Tested just on Account linking with Google Sign-In
  • You can see account linking on https://myaccount.google.com/permissions

Install Botium and Google Assistant Connector

When using Botium CLI:

> npm install -g botium-cli
> npm install -g botium-connector-google-assistant
> botium-cli init
> botium-cli run

When using Botium Bindings:

> npm install -g botium-bindings
> npm install -g botium-connector-google-assistant
> botium-bindings init mocha
> npm install && npm run mocha

When using Botium Box:

Already integrated into Botium Box, no setup required

Connecting Google Assistant SDK to Botium

1. Prepare googleConfig.json (Google credentials)

  • Configure an Actions Console project (See here) or open an existing one
  • If your Action is not yet live, enable device testing in the Actions Console to test it with Botium
  • Register a Device Model (See here) and download the OAuth 2.0 credentials file
    • Rename the file to googleConfig.json
    • You can download the credentials here as well
    • If you dont see device registrations while configuring your action, then check this or this

2. Run the "Botium Connector Google Actions Initialization Tool"

The connector repository includes a tool to compose the Botium capabilities (including private keys, access tokens etc). Create a project directory of your choice, and follow the steps below.

There are several ways of running this tool, depending on how you installed it:

When you are using the Botium CLI, then just run

> botium-cli init-google-assistant

When you installed the NPM package for this repository, then run

> npx botium-connector-google-assistant-init

When you cloned or downloaded this repository, and you are in the samples/convo folder, then run

> npm run init-google
or
> npx botium-connector-google-assistant-init

Follow the suggested steps:

  • you will be asked for location of the downloaded credential file
  • you will be presented a hyperlink you have to open in your browser to connect your Action to your Google account. You have to use the same Google account as for developing the action if action is not published yet.
  • you will be asked for start utterance, which activates(launches) your action. It is the same what you can see on Actions console simulator (https://console.actions.google.com/project/YOURPROJECTID/simulator).
  • and stop utterance, which deactivates your action.

3. Use the generated botium.json

A file named botium.json is generated containing the required capabilities to be used with Botium.

To check the configuration, run the emulator (Botium CLI required) to bring up a chat interface in your terminal window:

> botium-cli emulator

Botium setup is ready, you can begin to write your BotiumScript files.

How to start sample

There is a small tech demo in samples/convo with Botium Bindings. You can see there how to deal with different UI elements.

Before start create botium.json, and use this as Dialogflow project.

Start the test with:

> npm install
> npm test

Setting Location for Test Cases

Either set global with capabilities GOOGLE_ASSISTANT_LOCATION_LATITUDE and GOOGLE_ASSISTANT_LOCATION_LONGITUDE (see below).

Or with the UPDATE_CUSTOM logic hook in BotiumScript:

location

#begin
UPDATE_CUSTOM LOCATION|LATITUDE|48.210033
UPDATE_CUSTOM LOCATION|LONGITUDE|16.363449

#me
hi

#bot
...

Or for individual conversation steps (if this makes sense at all to switch location within a conversation ...):

location

#me
hi
UPDATE_CUSTOM LOCATION|LATITUDE|48.210033
UPDATE_CUSTOM LOCATION|LONGITUDE|16.363449

#bot
...

Supported Capabilities

Set the capability CONTAINERMODE to google-assistant to activate this connector.

GOOGLE_ASSISTANT_CLIENT_ID

See downloaded credential file

GOOGLE_ASSISTANT_CLIENT_SECRET

See downloaded credential file

GOOGLE_ASSISTANT_REFRESH_TOKEN

The simpliest way to acquire it, is the initialization tool described above

GOOGLE_ASSISTANT_TYPE

Set it to "authorized_user"

GOOGLE_ASSISTANT_START_UTTERANCE

If you want Botium to launch your own Google Action before starting a test case. It is something like "Talk to my test app" if the name of your app is "my test app", which is the default value.

GOOGLE_ASSISTANT_END_UTTERANCE

Use "Cancel"

GOOGLE_ASSISTANT_LOCATION_LATITUDE

Location latitude

GOOGLE_ASSISTANT_LOCATION_LONGITUDE

Location longitude