- Node.js and NPM
- We recommend installing using nvm for Linux/Mac and nvm-windows for Windows
- Install the Firebase CLI
- We recommend using MAJOR version
8
,npm install -g firebase-tools@^8.0.0
- Run
firebase login
with your Google account
- We recommend using MAJOR version
- Get an API key on the CTA website
- From the Actions on Google Console, New project > Create project > under What kind of Action do you want to build? > Custom > Blank project
- Install the Actions CLI
- Navigate to
sdk/settings/settings.yaml
, and replace<PROJECT_ID>
with your project ID- To find your project ID, click the three dots > Project Settings
- Navigate to the
sdk/
directory by runningcd sdk
from the root directory of this project. - Run
gactions login
to login to your account. - Run
gactions push
to push your project. - Update
settings.yaml
(or Settings in the Actions Console) to fix errors- e.g.
displayName
key must be unique from other Actions).
- e.g.
- Navigate to the functions directory.
- Run
npm install
- Run
firebase use --add
and follow the prompts to use your project. - Run
npm run deploy
. Follow console instructions to fix errors (i.e. update your billing plan). - Navigate to
functions/package.json
and update thename
key with your project name. - Configure your functions environment by running
firebase functions:config:set ctabustracker.key="THE API KEY"
with your API key from the CTA - Run
npm run deploy
again. Copy the function URL and paste it inbaseUrl
key insdk/webhooks/ActionsOnGoogleFulfillment.yaml
- Navigate to the
sdk/
directory and rungactions push
.
- Run
gactions deploy preview
to deploy your project. Alternatively, go to the Actions Console, refresh the page and click on the "Test" tab. - You can test your Action on any Google Assistant-enabled device on which the Assistant is signed into the same account used to create this project. Just say or type, “OK Google, talk to my test app”.
- You can also use the Actions on Google Console simulator to test most features and preview on-device behavior.
Deploying your function every time you update code gets annoying. So here is how you test locally. It is recommended to create another project solely for testing by following the instructions above.
- Run
npm i ngrok -g
. - Navigate to the
functions/
directory. firebase functions:config:get > .runtimeconfig.json
- If using Windows PowerShell, replace the above with:
firebase functions:config:get | ac .runtimeconfig.json
- If using Windows PowerShell, replace the above with:
- Run
npm run serve
. Note the port on which the function is running, usually 5001 - Run
ngrok http <PORT>
with the port number. - Copy the HTTPS forwarding URL and paste it in
baseUrl
key insdk/webhooks/ActionsOnGoogleFulfillment.yaml
- Run
gactions push
from thesdk/
directory. - Test code live from the Actions on Google Console simulator.
- Replace the
baseUrl
value with the original Firebase function URL- You can find this in your Firebase Console if it doesn't appear in your own.
- Run
npm run deploy
from thefunctions/
directory.
- Questions? Go to StackOverflow or the Assistant Developer Community on Reddit.
- For bugs, please report an issue on Github.
- Actions on Google Documentation
- Actions on Google Codelabs
- Firebase Environment Configuration
- Firebase Run Functions Locally
Please read and follow the steps in the CONTRIBUTING.md.
See LICENSE.