See the developer guide and release notes at https://developers.google.com/actions/ for more details.
skip
Add your first action
build
CREATE
(continued from above step)settings
and click export and import
, then click restore from zip
.models/dialogflow/
and use that zip to restore the project.
Run server local with colorful logs
npm install -g firebase-tools
touch functions/.runtimeconfig.json
and add fake keys (temporary workaround) refer thisfirebase init
(remove .firebaserc first)firebase use --add
(and choose your own firebase project)cd functions
and npm install
DEBUG=ia:* npm start
To expose server to google assistant use ngrok its free plan should be enough.
To publish 5000 port use:
ngrok http 5000
you should find url https://<id>.ngrok.io/
.
Go to the fullfillment section of your dialogflow draft copy of our app and after that you should use this url:
https://<id>.ngrok.io/<your project name>/us-central1/assistant
The Alexa app workflow for dev/production is the following:
More details follow.
Node 12 is required. There is a problem with newer Node versions, bespoken-tools
which is a key dependency, is not supporting it. Use nvm install 12
and nvm use 12
to switch to Node 12 before running any other command.
The general idea is that there are 2 AWS S3 buckets, dev
and production
.
You can access them via https://aws.amazon.com/ -> sign in -> S3.
You need to create a zip
with the app, you upload it to the relevant S3 bucket
and then you go to AWS Lambda dev
/ production
to select which app
should be loaded via its S3 URL.
(AWS -> Lambda -> edit app -> "upload from S3 .zip file").
S3 buckets have multiple app versions. This way, you can also easily rollback to a previous version if needed.
The script that produces the app.zip
that we upload to S3 is bin/deploy-to-alexa-skill.sh
.
An important AWS Lambda limitation is that the unzip code filesize should be < 250MB.
To achieve that, we do:
(cd ./deploy/alexa/; npm install --production; rm -rf node_modules/aws-sdk; node-prune node_modules)
aws-sdk
is already preinstalled in AWS Lambda, so we don't need it.
npm install -g node-prune
is a pre-requisite. This tool removes files that are useless in production
and reduces the total filesize a lot.
After deploying to dev or production, use https://developer.amazon.com/alexa/console/ask#
ACTIONS -> Test
for testing.
PROFILE_REQUESTS=true
(false
by default)
firebase functions:config:set performance.requests=true
:mag: get one good first issue assign yourself (if you have access) or write comment that you'd like to work on this issue. That's help to prevent work overlapping.
create git branch feature/<name-of-feature>
, more
:computer: working on it
Use Mocha for continuous checking of your code quality and cover functionality by tests
npm run mocha -- --watch
:coffee: Complete checking of code by run unit tests and code style checking
npm test
:star2: We follow standard javascript code style.
Automatic style fixing, it doesn't solve all problems but could be very helpful
npm run lint -- --fix
:tada: Finally make Pull Request and give complete description what have you done and link the addressed issue.
Also it could be good practice to create your Pull Request earlier,
but add WIP:
at the beginning of its name! This way other developers
could see what are you working right now.